【问题标题】:ColdFusion REST 404冷融合 REST 404
【发布时间】:2017-03-13 20:04:16
【问题描述】:

我正在设置 ColdFusion 2016 RESTful Web 服务,但不断收到 404 错误。第一步,我通过CF admin注册了一个rest服务。

C:\users\dev_2\ColdFusion Builder 2016 工作区\svn\restful 并将其命名为 IIT。

现在,我有 C:\users\dev_2\ColdFusion Builder 2016 工作区\svn\restful\restTest.cfc,即:

<cfcomponent restpath="restTest" rest="true" >
<!--- handle GET request (httpmethod), take argument in restpath(restpath={customerID}), return query data in json format(produces=text/json) ---> 
<cffunction name="getHandlerJSON" access="remote" httpmethod="GET" restpath="{customerID}" returntype="query" produces="application/json"> 
    <cfargument name="customerID" required="true" restargsource="Path" type="numeric"> 
    <cfset myQuery = queryNew("id,name", "Integer,varchar", [[1, "Sagar"], [2, "Ganatra"]])> 
    <cfquery dbtype="query" name="resultQuery"> 
        select * from myQuery 
        where id = #arguments.customerID# 
    </cfquery> 
    <cfreturn resultQuery> 
</cffunction> 
</cfcomponent>  

我还创建了 C:\users\dev_2\ColdFusion Builder 2016 工作区\svn\restful\Test.cfm,其中包含以下内容:

<cfhttp url="https://local.mydomain.com/rest/IIT/restTest/1" method="get" result="res">   
<cfhttpparam type="header" name="Accept" value="application/json">

当我运行 Test.cfm 时,我得到 404 Not Found。我在这里想念什么?我正在关注此链接的回复 REST - 404 Not Found 但没有骰子。感谢您的宝贵时间!

【问题讨论】:

    标签: rest coldfusion coldfusion-2016


    【解决方案1】:

    根本原因是因为coldfusion需要在设置rest服务之前映射rest API目录。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-02-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-13
      • 2011-01-15
      • 1970-01-01
      相关资源
      最近更新 更多