ColdFusion 11似乎提供了超类和类的定义

ColdFusion 11似乎提供了超类和类的定义,coldfusion,coldfusion-8,coldfusion-11,Coldfusion,Coldfusion 8,Coldfusion 11,在ColdFusion应用程序中,我有一个名为ProjectBeanService的类,它扩展了另一个名为AjaxBeanService的类 在CF8中,代码似乎工作正常,在IE中调试应用程序时,我看到以下呈现的JavaScript: <script type="text/javascript"> var _cf_ProjectBeanService=ColdFusion.AjaxProxy.init('/components/ProjectBeanService.cfc',

在ColdFusion应用程序中,我有一个名为ProjectBeanService的类,它扩展了另一个名为AjaxBeanService的类

在CF8中,代码似乎工作正常,在IE中调试应用程序时,我看到以下呈现的JavaScript:

<script type="text/javascript">
    var _cf_ProjectBeanService=ColdFusion.AjaxProxy.init('/components/ProjectBeanService.cfc','ProjectBeanService');
    _cf_ProjectBeanService.prototype.get=function(sPropertyName,sBeanType,nID,sSection,nRevision) { return ColdFusion.AjaxProxy.invoke(this, "get", {sPropertyName:sPropertyName,sBeanType:sBeanType,nID:nID,sSection:sSection,nRevision:nRevision});};
    _cf_ProjectBeanService.prototype.getAll=function(sBeanType,nID,sSection,nRevision) { return ColdFusion.AjaxProxy.invoke(this, "getAll", {sBeanType:sBeanType,nID:nID,sSection:sSection,nRevision:nRevision});};
    _cf_ProjectBeanService.prototype.set=function(sPropertyName,oPropertyValue,sBeanType,nID,sSection,nRevision) { return ColdFusion.AjaxProxy.invoke(this, "set", {sPropertyName:sPropertyName,oPropertyValue:oPropertyValue,sBeanType:sBeanType,nID:nID,sSection:sSection,nRevision:nRevision});};
</script>

var_cf_ProjectBeanService=ColdFusion.AjaxProxy.init('/components/ProjectBeanService.cfc','ProjectBeanService');
_cf_ProjectBeanService.prototype.get=函数(sprPropertyName,sBeanType,nID,sSection,nRevision){return ColdFusion.AjaxProxy.invoke(this,“get”,{sprPropertyName:sprPropertyName,sBeanType:sBeanType,nID:nID,sSection:sSection,nRevision:nRevision});
_cf_ProjectBeanService.prototype.getAll=function(sBeanType,nID,sSection,nRevision){return ColdFusion.AjaxProxy.invoke(这个,“getAll”,{sBeanType:sBeanType,nID:nID,sSection:sSection,nRevision:nRevision});
_cf_ProjectBeanService.prototype.set=函数(sprPropertyName,opPropertyValue,sBeanType,nID,sSection,nRevision){return ColdFusion.AjaxProxy.invoke(this,“set”,{sprPropertyName:sprPropertyName,opPropertyValue:opPropertyValue,sBeanType:sBeanType,nID:nID,sSection:sSection,nRevision:nRevision});
但是,当我尝试在CF11下运行相同的应用程序时,会呈现类方法和超类方法:

<script type="text/javascript">/* <![CDATA[ */
    var _cf_ProjectBeanService=ColdFusion.AjaxProxy.init('/components/ProjectBeanService.cfc','ProjectBeanService');
    _cf_ProjectBeanService.prototype.get=function(sPropertyName,sBeanType,nID,sSection,nRevision) { return ColdFusion.AjaxProxy.invoke(this, "get","4789898A8974AC60", {sPropertyName:sPropertyName,sBeanType:sBeanType,nID:nID,sSection:sSection,nRevision:nRevision});};
    _cf_ProjectBeanService.prototype.getAll=function(sBeanType,nID,sSection,nRevision) { return ColdFusion.AjaxProxy.invoke(this, "getAll","4789898A8974AC60", {sBeanType:sBeanType,nID:nID,sSection:sSection,nRevision:nRevision});};
    _cf_ProjectBeanService.prototype.set=function(sPropertyName,oPropertyValue,sBeanType,nID,sSection,nRevision) { return ColdFusion.AjaxProxy.invoke(this, "set","4789898A8974AC60", {sPropertyName:sPropertyName,oPropertyValue:oPropertyValue,sBeanType:sBeanType,nID:nID,sSection:sSection,nRevision:nRevision});};
    _cf_ProjectBeanService.prototype.get=function(sBeanName,sPropertyName) { return ColdFusion.AjaxProxy.invoke(this, "get","4789898A8974AC60", {sBeanName:sBeanName,sPropertyName:sPropertyName});};
    _cf_ProjectBeanService.prototype.destroySessionBean=function(sBeanName) { return ColdFusion.AjaxProxy.invoke(this, "destroySessionBean","4789898A8974AC60", {sBeanName:sBeanName});};
    _cf_ProjectBeanService.prototype.createSessionBean=function(sBeanName,sBeanType,sDAOName) { return ColdFusion.AjaxProxy.invoke(this, "createSessionBean","4789898A8974AC60", {sBeanName:sBeanName,sBeanType:sBeanType,sDAOName:sDAOName});};
    _cf_ProjectBeanService.prototype.getAll=function(sBeanName) { return ColdFusion.AjaxProxy.invoke(this, "getAll","4789898A8974AC60", {sBeanName:sBeanName});};
    _cf_ProjectBeanService.prototype.getSessionBean=function(sBeanName) { return ColdFusion.AjaxProxy.invoke(this, "getSessionBean","4789898A8974AC60", {sBeanName:sBeanName});};
    _cf_ProjectBeanService.prototype.set=function(sBeanName,sPropertyName,oPropertyValue) { return ColdFusion.AjaxProxy.invoke(this, "set","4789898A8974AC60", {sBeanName:sBeanName,sPropertyName:sPropertyName,oPropertyValue:oPropertyValue});};
    _cf_ProjectBeanService.prototype.reInitSessionBean=function(sBeanName,argument1,argument2,argument3,argument4) { return ColdFusion.AjaxProxy.invoke(this, "reInitSessionBean","4789898A8974AC60", {sBeanName:sBeanName,argument1:argument1,argument2:argument2,argument3:argument3,argument4:argument4});};
/* ]]> */</script>
/**/
在这段代码中,请注意在定义了“set”函数之后,如何再次定义它(并根据超类定义)。在我看来,ColdFusion 11正在呈现这个超类,而CF 8没有

有什么建议吗

更新:

这里是应用程序的精简版本,我可以在其中重现错误

/组件/AbstractAjax.cfc:

<cfcomponent displayname="AbstractAjax">

    <cffunction name="sendError" access="private" returntype="void">
        <cfargument name="sErrCode" type="string" required="yes" />
        <cfargument name="sErrMsg" type="string" required="yes" />      
        <cfif IsNumeric(arguments.sErrCode)>
            <cfscript>
                GetPageContext().getResponse().sendError(arguments.sErrCode,arguments.sErrMsg);
         </cfscript>
      <cfelse>
        <cfscript>
            GetPageContext().getResponse().sendError(555,arguments.sErrCode & ' - ' & arguments.sErrMsg);
         </cfscript>
      </cfif>
    </cffunction>

</cfcomponent>

GetPageContext().getResponse().sendError(arguments.sErrCode,arguments.sErrMsg);
GetPageContext().getResponse().sendError(555,arguments.sErrCode&'-'和arguments.sErrMsg);
/组件/AjaxBeanService.cfc:

<cfcomponent displayname="AjaxBeanService" extends="com.AbstractAjax">

    <cffunction name="createSessionBean" access="remote" returntype="struct">
        <cfargument name="sBeanName" type="string" required="yes">
        <cfargument name="sBeanType" type="string" required="yes">
        <cfargument name="sDAOName" type="string" required="yes">
        <cfset var oBean = StructNew() />
        <cfset var oBeanArguments = ARGUMENTS />
        <cfset var oDAO = application[sDAOName] />

        <cftry>
            <cfset oBean = createObject("component","com." & sBeanType) />

             <!--- delete first 3 elements from arguments array --->
            <cfset ArrayDeleteAt(oBeanArguments,1) />
            <cfset ArrayDeleteAt(oBeanArguments,1) />
            <cfset ArrayDeleteAt(oBeanArguments,1) />

            <!--- make the DAO object the first argument --->
            <cfset ArrayPrepend(oBeanArguments,oDAO) />

            <cfset oBean.init.apply(oBean,oBeanArguments) />
            <cfset SESSION.beans[sBeanName] = oBean />
            <cfreturn oBean.getAll() />
            <cfcatch type="any">
                <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
    </cffunction>

    <cffunction name="destroySessionBean" access="remote" returntype="struct">
        <cfargument name="sBeanName" type="string" required="yes">
        <cfset rc = StructDelete(SESSION.beans, "#sBeanName#", "True")>
    </cffunction>

    <cffunction name="reInitSessionBean" access="remote" returntype="struct">
        <cfargument name="sBeanName" type="string" required="yes">
        <cfargument name="argument1" type="any" required="no" default="">
        <cfargument name="argument2" type="any" required="no" default="">
        <cfargument name="argument3" type="any" required="no" default="">
        <cfargument name="argument4" type="any" required="no" default="">
       <cfset var oBean = StructNew() />
        <cftry>
            <cfset oBean = getSessionBean(sBeanName) />           
            <cfset oBean.init(oBean.getDAO(),argument1,argument2,argument3,argument4) />
            <cfset SESSION.beans[sBeanName] = oBean />
            <cfreturn oBean.getAll() />
            <cfcatch type="any">
                <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
    </cffunction>

    <cffunction name="getSessionBean" access="remote" returntype="any">
        <cfargument name="sBeanName" type="string" required="yes">
        <cfset var oBean = StructNew() />
        <cfif StructKeyExists(SESSION.beans,sBeanName) >
            <cflock scope="session" type="readonly" timeout="5" throwontimeout="yes">
                <cfset oBean = Duplicate(SESSION.beans[sBeanName]) />
            </cflock>
        </cfif>
        <cfif StructIsEmpty(oBean)>
            <cfthrow errorcode="500" message="No bean found by the name '#sBeanname#'" />
        <cfelse>
            <cfreturn oBean />
        </cfif>
    </cffunction>

    <cffunction name="set" access="remote" returntype="void">
        <cfargument name="sBeanName" type="string" required="yes">
        <cfargument name="sPropertyName" type="string" required="yes">
        <cfargument name="oPropertyValue" type="string" required="yes">
        <cfset var oBean = StructNew() />
        <cftry>
            <cfset oBean = getSessionBean(sBeanName) />
            <cfset oBean.set(sPropertyName,oPropertyValue) />
            <cfcatch type="any">
                 <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
     </cffunction>

    <cffunction name="get" access="remote" returntype="any">
        <cfargument name="sBeanName" type="string" required="yes">
        <cfargument name="sPropertyName" type="string" required="yes">

        <cfset var value = "" />
        <cfset var oBean = StructNew() />

        <cftry>      
            <cfset oBean = getSessionBean(sBeanName) />
            <cfset value = oBean.get(sPropertyName) />
            <cfreturn value />

            <cfcatch type="any">
                    <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
     </cffunction>

     <cffunction name="getAll" access="remote" returntype="struct">
        <cfargument name="sBeanName" type="string" required="yes">

        <cfset var oBean = StructNew() />
        <cfset var oStruct = structNew() />

        <cftry>      
            <cfset oBean = getSessionBean(sBeanName) />
            <cfset oStruct = oBean.getAll() />
            <cfreturn oStruct />

            <cfcatch type="any">
                  <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
     </cffunction>

</cfcomponent>
<cfcomponent displayname="ProjectBeanService" extends="com.AjaxBeanService">

    <cffunction name="getBean" access="private" returntype="any">
        <cfargument name="sBeanType" type="string" required="yes">
        <cfargument name="nID" type="numeric" required="yes" hint="ProjectID or ImpactID">
        <cfargument name="sSection" type="string" required="no" hint="ProjectSection or ImpactSection" default="">
        <cfargument name="nRevision" type="numeric" required="no" hint="Commitment Revision" default="0">

        <cfset var oBean = createObject("component","com." & sBeanType).init(nID,sSection,nRevision)  />

        <cfreturn oBean />

    </cffunction>

    <cffunction name="set" access="remote" returntype="void">
        <cfargument name="sPropertyName" type="string" required="yes">
        <cfargument name="oPropertyValue" type="string" required="yes">
        <cfargument name="sBeanType" type="string" required="yes">
        <cfargument name="nID" type="numeric" required="yes">
        <cfargument name="sSection" type="string" required="no" default="">
        <cfargument name="nRevision" type="numeric" required="no" default="0">
        <cfset var oBean = StructNew() />
        <cftry>

            <cfset oBean = getBean(sBeanType, nID, sSection,nRevision) />
            <cfset oBean.set(sPropertyName,oPropertyValue) />
            <cfcatch type="any">
                 <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
     </cffunction>

    <cffunction name="get" access="remote" returntype="any">
        <cfargument name="sPropertyName" type="string" required="yes">
        <cfargument name="sBeanType" type="string" required="yes">
        <cfargument name="nID" type="numeric" required="yes">
        <cfargument name="sSection" type="string" required="no" default="">
        <cfargument name="nRevision" type="numeric" required="no" default="0">

        <cfset var value = "" />
        <cfset var oBean = StructNew() />

        <cftry>      
            <cfset oBean = getBean(sBeanType,nID,sSection,nRevision) />
            <cfset value = oBean.get(sPropertyName) />
            <cfreturn value />

            <cfcatch type="any">
                    <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
     </cffunction>

     <cffunction name="getAll" access="remote" returntype="struct">
        <cfargument name="sBeanType" type="string" required="no" default="ProjectBean">
        <cfargument name="nID" type="numeric" required="yes">
        <cfargument name="sSection" type="string" required="no" default="">
        <cfargument name="nRevision" type="numeric" required="no" default="0">

        <cfset var oBean = StructNew() />
        <cfset var oStruct = structNew() />

        <cftry>      
            <cfset oBean = getBean(sBeanType,nID,sSection,nRevision) />
            <cfset oStruct = oBean.getAll() />
            <cfreturn oStruct />

            <cfcatch type="any">
                  <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
     </cffunction>

</cfcomponent>

/组件/项目BeanService.cfc:

<cfcomponent displayname="AjaxBeanService" extends="com.AbstractAjax">

    <cffunction name="createSessionBean" access="remote" returntype="struct">
        <cfargument name="sBeanName" type="string" required="yes">
        <cfargument name="sBeanType" type="string" required="yes">
        <cfargument name="sDAOName" type="string" required="yes">
        <cfset var oBean = StructNew() />
        <cfset var oBeanArguments = ARGUMENTS />
        <cfset var oDAO = application[sDAOName] />

        <cftry>
            <cfset oBean = createObject("component","com." & sBeanType) />

             <!--- delete first 3 elements from arguments array --->
            <cfset ArrayDeleteAt(oBeanArguments,1) />
            <cfset ArrayDeleteAt(oBeanArguments,1) />
            <cfset ArrayDeleteAt(oBeanArguments,1) />

            <!--- make the DAO object the first argument --->
            <cfset ArrayPrepend(oBeanArguments,oDAO) />

            <cfset oBean.init.apply(oBean,oBeanArguments) />
            <cfset SESSION.beans[sBeanName] = oBean />
            <cfreturn oBean.getAll() />
            <cfcatch type="any">
                <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
    </cffunction>

    <cffunction name="destroySessionBean" access="remote" returntype="struct">
        <cfargument name="sBeanName" type="string" required="yes">
        <cfset rc = StructDelete(SESSION.beans, "#sBeanName#", "True")>
    </cffunction>

    <cffunction name="reInitSessionBean" access="remote" returntype="struct">
        <cfargument name="sBeanName" type="string" required="yes">
        <cfargument name="argument1" type="any" required="no" default="">
        <cfargument name="argument2" type="any" required="no" default="">
        <cfargument name="argument3" type="any" required="no" default="">
        <cfargument name="argument4" type="any" required="no" default="">
       <cfset var oBean = StructNew() />
        <cftry>
            <cfset oBean = getSessionBean(sBeanName) />           
            <cfset oBean.init(oBean.getDAO(),argument1,argument2,argument3,argument4) />
            <cfset SESSION.beans[sBeanName] = oBean />
            <cfreturn oBean.getAll() />
            <cfcatch type="any">
                <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
    </cffunction>

    <cffunction name="getSessionBean" access="remote" returntype="any">
        <cfargument name="sBeanName" type="string" required="yes">
        <cfset var oBean = StructNew() />
        <cfif StructKeyExists(SESSION.beans,sBeanName) >
            <cflock scope="session" type="readonly" timeout="5" throwontimeout="yes">
                <cfset oBean = Duplicate(SESSION.beans[sBeanName]) />
            </cflock>
        </cfif>
        <cfif StructIsEmpty(oBean)>
            <cfthrow errorcode="500" message="No bean found by the name '#sBeanname#'" />
        <cfelse>
            <cfreturn oBean />
        </cfif>
    </cffunction>

    <cffunction name="set" access="remote" returntype="void">
        <cfargument name="sBeanName" type="string" required="yes">
        <cfargument name="sPropertyName" type="string" required="yes">
        <cfargument name="oPropertyValue" type="string" required="yes">
        <cfset var oBean = StructNew() />
        <cftry>
            <cfset oBean = getSessionBean(sBeanName) />
            <cfset oBean.set(sPropertyName,oPropertyValue) />
            <cfcatch type="any">
                 <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
     </cffunction>

    <cffunction name="get" access="remote" returntype="any">
        <cfargument name="sBeanName" type="string" required="yes">
        <cfargument name="sPropertyName" type="string" required="yes">

        <cfset var value = "" />
        <cfset var oBean = StructNew() />

        <cftry>      
            <cfset oBean = getSessionBean(sBeanName) />
            <cfset value = oBean.get(sPropertyName) />
            <cfreturn value />

            <cfcatch type="any">
                    <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
     </cffunction>

     <cffunction name="getAll" access="remote" returntype="struct">
        <cfargument name="sBeanName" type="string" required="yes">

        <cfset var oBean = StructNew() />
        <cfset var oStruct = structNew() />

        <cftry>      
            <cfset oBean = getSessionBean(sBeanName) />
            <cfset oStruct = oBean.getAll() />
            <cfreturn oStruct />

            <cfcatch type="any">
                  <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
     </cffunction>

</cfcomponent>
<cfcomponent displayname="ProjectBeanService" extends="com.AjaxBeanService">

    <cffunction name="getBean" access="private" returntype="any">
        <cfargument name="sBeanType" type="string" required="yes">
        <cfargument name="nID" type="numeric" required="yes" hint="ProjectID or ImpactID">
        <cfargument name="sSection" type="string" required="no" hint="ProjectSection or ImpactSection" default="">
        <cfargument name="nRevision" type="numeric" required="no" hint="Commitment Revision" default="0">

        <cfset var oBean = createObject("component","com." & sBeanType).init(nID,sSection,nRevision)  />

        <cfreturn oBean />

    </cffunction>

    <cffunction name="set" access="remote" returntype="void">
        <cfargument name="sPropertyName" type="string" required="yes">
        <cfargument name="oPropertyValue" type="string" required="yes">
        <cfargument name="sBeanType" type="string" required="yes">
        <cfargument name="nID" type="numeric" required="yes">
        <cfargument name="sSection" type="string" required="no" default="">
        <cfargument name="nRevision" type="numeric" required="no" default="0">
        <cfset var oBean = StructNew() />
        <cftry>

            <cfset oBean = getBean(sBeanType, nID, sSection,nRevision) />
            <cfset oBean.set(sPropertyName,oPropertyValue) />
            <cfcatch type="any">
                 <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
     </cffunction>

    <cffunction name="get" access="remote" returntype="any">
        <cfargument name="sPropertyName" type="string" required="yes">
        <cfargument name="sBeanType" type="string" required="yes">
        <cfargument name="nID" type="numeric" required="yes">
        <cfargument name="sSection" type="string" required="no" default="">
        <cfargument name="nRevision" type="numeric" required="no" default="0">

        <cfset var value = "" />
        <cfset var oBean = StructNew() />

        <cftry>      
            <cfset oBean = getBean(sBeanType,nID,sSection,nRevision) />
            <cfset value = oBean.get(sPropertyName) />
            <cfreturn value />

            <cfcatch type="any">
                    <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
     </cffunction>

     <cffunction name="getAll" access="remote" returntype="struct">
        <cfargument name="sBeanType" type="string" required="no" default="ProjectBean">
        <cfargument name="nID" type="numeric" required="yes">
        <cfargument name="sSection" type="string" required="no" default="">
        <cfargument name="nRevision" type="numeric" required="no" default="0">

        <cfset var oBean = StructNew() />
        <cfset var oStruct = structNew() />

        <cftry>      
            <cfset oBean = getBean(sBeanType,nID,sSection,nRevision) />
            <cfset oStruct = oBean.getAll() />
            <cfreturn oStruct />

            <cfcatch type="any">
                  <cfset sendError(cfcatch.ErrorCode,cfcatch.message) />
            </cfcatch>
        </cftry>
     </cffunction>

</cfcomponent>

/Application.cfc:

<cfcomponent>
    <cfscript>
        this.mappings["/com"] = getDirectoryFromPath(getCurrentTemplatePath()) & "\components\";    
   </cfscript> 
</cfcomponent>

this.mappings[“/com”]=getDirectoryFromPath(getCurrentTemplatePath())和“\components\”;
/index.cfm:

<html>
<head>
<title></title>    
   <cfajaxproxy cfc="com.ProjectBeanService" jsclassname="ProjectBeanService">   
</head>
<body>
<span>This is a test.</span>
</body>
</html>

这是一个测试。

到目前为止,我得到的唯一答案是这一定是CF11中的一个bug,因此我能够通过将父类中的方法标记为具有“public”而不是“remote”访问权限来“修复”它。我还不知道这会带来什么意外后果,但它似乎已经解决了我的问题。如果有人有更好的建议,请让我知道,我会给那个人检查答案。

这会给你带来什么实际问题?如果子类方法代理设置在基类方法代理之后,它们不会简单地替换它们吗?很酷,很抱歉你这么说。你能为这个做一个独立的复制,这样我们就可以在本地测试它了吗?两个缩减的CFC文件和一个CFM文件。真可爱。你能把它包括在你的问题里吗。与导致代码的代码相比,代码的最终结果没有那么有用。我现在像黄鼠狼一样愤怒,但我明天回到甲板上做更多的研究时会检查这一点,看起来CF8中有一个bug阻止标记为remote的函数通过CFAJAXPROXY继承,这个bug将在CF9中修复。因此,可以安全地假设,由于修复,所有方法现在都出现了。然而,这仍然不能解释为什么父类方法的代理是最后声明的,覆盖了子类方法。