66 lines
2.5 KiB
Plaintext
66 lines
2.5 KiB
Plaintext
<cfcomponent displayname="Application" output="true">
|
|
|
|
<cfset this.Name = "tfluceecrud" />
|
|
<cfset this.applicationTimeout = createTimeSpan(0, 0, 3, 0) />
|
|
<cfset this.sessionmanagement = "Yes" />
|
|
<cfset this.sessiontimeout = CreateTimeSpan(0, 0, 120, 0) />
|
|
|
|
<cfset this.datasource = "testds" />
|
|
<cfset getDS(this.datasource, this.datasource) />
|
|
|
|
<cfsetting requesttimeout="20" showdebugoutput="false" />
|
|
|
|
<cffunction name="OnApplicationStart" access="public" returntype="boolean">
|
|
<cfreturn true />
|
|
</cffunction>
|
|
|
|
<cffunction name="OnRequestStart" access="public" returntype="boolean">
|
|
<cfset request.tableName = createObject("java", "java.lang.System").getEnv().get("TABLE_NAME") />
|
|
<cfif NOT isDefined("request.tableName") OR NOT len(request.tableName)>
|
|
<cfset request.tableName = "check_point" />
|
|
</cfif>
|
|
<cftry>
|
|
<cfquery>
|
|
CREATE TABLE IF NOT EXISTS #request.tableName# (
|
|
id SERIAL PRIMARY KEY,
|
|
value TEXT NOT NULL DEFAULT ''
|
|
)
|
|
</cfquery>
|
|
<cfcatch type="database"></cfcatch>
|
|
</cftry>
|
|
|
|
<cfreturn true />
|
|
</cffunction>
|
|
|
|
<cffunction name="OnRequest" access="public" returntype="void">
|
|
<cfargument name="template" type="string" required="true" />
|
|
|
|
<cfset setEncoding("FORM", "UTF-8") />
|
|
<cfset setEncoding("URL", "UTF-8") />
|
|
|
|
<cfset local.basePath = getDirectoryFromPath(getCurrentTemplatePath()) />
|
|
<cfset request.webRoot = "../" />
|
|
<cfset request.thisPage = Replace(ReplaceNoCase(expandPath(arguments.template), local.basePath, ""), "\", "/") />
|
|
|
|
<cfinclude template="#arguments.template#" />
|
|
</cffunction>
|
|
|
|
<cffunction name="getDS" access="private" returntype="void">
|
|
<cfargument name="dsname" type="string" required="true" />
|
|
<cfargument name="prefix" type="string" default="#dsname#" />
|
|
|
|
<cfset system = createObject("java", "java.lang.System") />
|
|
<cfset var ds = {} />
|
|
|
|
<cfloop list="class,connectionString,username,password,bundleName,bundleVersion,connectionLimit,liveTimeout,validate" item="field">
|
|
<cfset var value = system.getEnv("#arguments.prefix#_#field#") />
|
|
<cfif isDefined("value") AND len(value)>
|
|
<cfset structInsert(ds, field, value) />
|
|
</cfif>
|
|
</cfloop>
|
|
|
|
<cfset THIS.datasources[dsname] = ds />
|
|
</cffunction>
|
|
|
|
</cfcomponent>
|