测试ColdFusion中是否存在FORM范围/结构

Goy*_*uix 2 coldfusion railo application.cfc

问题:在为CFC请求WSDL时,我收到以下错误:变量FORM未定义.它发生在这行代码中,位于application.cfc中的OnRequestStart方法中

<cfif structKeyExists(form,'resetappvars')>
    <cfset OnApplicationStart() />
</cfif>
Run Code Online (Sandbox Code Playgroud)

如果我请求一个特定的方法,它工作正常.我已经考虑过使用cfparam创建一个默认的表单结构,如果不存在,但这看起来像一个丑陋的黑客,我担心它实际上会在CFC的变量或这个范围内创建表单结构.也许这也是一个合法的错误?

注意:这只发生在我请求WSDL时,如果我直接调用一个方法 - 代码按预期执行而没有问题.

更新: Application.cfc代码示例 - 只需将任何CFC添加到您的应用程序并请求它?wsdl以查看问题.这已经在ColdFusion 7和ColdFusion 8上测试过(并且失败了).

<cfcomponent output="false">

    <cffunction name="OnApplicationStart" access="public" returntype="boolean" output="false" hint="Fires when the application is first created.">
        <cfset application.dsn = "my_dsn" />
        <cfreturn true />
    </cffunction>

    <cffunction name="OnRequestStart" access="public" returntype="boolean" output="false" hint="Fires at first part of page processing.">
        <cfargument name="TargetPage" type="string" required="true" />
        <cfif structKeyExists(form,'resetappvars')>
            <cfset OnApplicationStart() />
        </cfif>
        <cfreturn true />
    </cffunction>
</cfcomponent>
Run Code Online (Sandbox Code Playgroud)

Ale*_*eid 8

也许尝试添加一个:

 <cfif IsDefined("form")>...</cfif>
Run Code Online (Sandbox Code Playgroud)

围绕上面的代码?