什麼是用於cfsetting的ColdFusion 9腳本語法?



Answers

試試這個

<cfscript>
createObject( "java", "coldfusion.tagext.lang.SettingTag" ).setRequestTimeout( javaCast( "double", 20 ) );
</cfscript>

或這個

<cfscript>
createObject( "java", "coldfusion.runtime.RequestMonitor" ).overrideRequestTimeout( javaCast( "long", 20 ) );
</cfscript>

其中20是您的cfsetting requesttimeout值

Question

我試圖將一個Application.cfc轉換為腳本。 原來有這個:

<cfcomponent displayname="Application" output="false">
     <cfset this.name               = "testing">
     <cfset this.applicationTimeout = createTimeSpan(0,1,0,0)>
     <cfset this.sessionManagement  = true>
     <cfset this.sessionTimeout     = createTimeSpan(0,0,30,0)>

     <cfsetting requesttimeout="20">
     ...

我無法弄清楚如何將cfsetting標籤轉換為腳本。 以下嘗試不起作用:

setting requesttimeout="20"; // throws a "function keyword is missing in FUNCTION declaration." error.
setting( requesttimeout="20" ); // throws a "Variable SETTING is undefined." error.

它看起來像Railo可能支持它( 鏈接 ),但我找不到在ColdFusion的文檔中cfsetting標籤的等效




這些cfml腳本:

<cfsetting enablecfoutputonly="true" />
<cfsetting requesttimeout="60" />
<cfsetting showdebugoutput="false" />

應該在cfscript中工作,如下所示:

createObject( "java", "coldfusion.tagext.lang.SettingTag" ).setEnablecfoutputonly(true);
createObject( "java", "coldfusion.tagext.lang.SettingTag" ).setRequestTimeout(javaCast( "double", 60 ));
createObject( "java", "coldfusion.tagext.lang.SettingTag" ).setShowdebugoutput(false);





Related