0

我们有一个 ColdFusion 8 应用程序在 Windows Server 2003 上的 JRun4 中运行。

我们如何检测(和显示)调试器是否在 CF Administrator 中启用了允许线路调试的情况下运行。检测后,我们希望在调试器正在运行的应用程序上显示警告。

4

1 回答 1

4

您应该能够为此使用 ColdFusion 管理员 API。当然,您需要安全/权限才能使用它。如果您使用沙盒安全性,请启用对cf_web_root/CFIDE/adminapi目录的访问以使用管理员 API。基本上,Administrator API 使您能够以编程方式访问大部分ColdFusion Administrator 设置。

从文档中

您可以使用管理员 API 以编程方式执行大多数 ColdFusion 管理员任务。管理员 API 由一组 ColdFusion 组件 (CFC) 组成,其中包含您调用以执行管理员任务的方法。

用于管理调试设置的 CFC 是debugging.cfc.

这是一些伪代码(尚未经过测试):

<cfscript> 

// Instantiate the administrator.cfc 
adminObj = createObject("component","cfide.adminapi.administrator");

// Call the administrator.cfc login method, passing the ColdFusion Administrator password
adminObj.login("#password#","#username#");

// Instantiate the debugging CFC
debugObj = createObject("component","cfide.adminapi.debugging");

// Call the desired CFC method
if (debugObj.isLineDebuggerEnabled()) {

    if (debugObj.isLineDebuggerRunning()) {

        // Stop line debugger
        debugObj.stopLineDebugger();
    }

    // Disable the line debugger
    debugObj.setLineDebuggerEnabled(enabled="false");
}

</cfscript>

那应该让你开始。这是有关 debugging.cfc 及其方法的一些文档

Manages debug settings.

hierarchy:  WEB-INF.cftags.component
            CFIDE.adminapi.base
            CFIDE.adminapi.debugging
path:   {web-root}\CFIDE\adminapi\debugging.cfc
serializable:   Yes
properties: 
methods:  addDebugEvent,
          deleteIP,
          getCurrentIP,
          getDebugProperty,
          getDebugRecordset,
          getIPList,
          getLineDebuggerPort,
          getLogProperty,
          getMaxDebuggingSessions,
          isLineDebuggerEnabled,
          isLineDebuggerRunning,
          restartLineDebugger,
          setDebugProperty,
          setIP,
          setLineDebuggerEnabled,
          setLineDebuggerPort,
          setLogProperty,
          setMaxDebuggingSessions,
          startLineDebugger,
          stopLineDebugger,
          validateIP*
inherited methods:  dump,
                    getEdition,
                    getInstallType,
                    getJRunRootDir,
                    isAdminUser,
                    RDSInvoker,
                    setJrunSN
于 2017-06-06T13:48:04.493 回答