簡體   English   中英

ColdFusion REST 404

[英]ColdFusion REST 404

我正在設置ColdFusion 2016 RESTful Web服務,但始終收到404錯誤。 第一步,我通過CF管理員注冊了休息服務。

C:\\ users \\ dev_2 \\ ColdFusion Builder 2016 workspacce \\ svn \\ restful,並將其稱為IIT。

現在,我有C:\\ users \\ dev_2 \\ ColdFusion Builder 2016 workspacce \\ 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 workspacce \\ 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但沒有骰子的響應。 謝謝你的時間!

根本原因是因為Coldfusion需要在設置rest服務之前映射rest API目錄。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM