我正在设置 ColdFusion 2016 RESTful Web 服务,但不断收到 404 错误。第一步,我通过 CF admin 注册了一个休息服务。
C:\users\dev_2\ColdFusion Builder 2016 workspace\svn\restful 并将其称为 IIT。
现在,我有 C:\users\dev_2\ColdFusion Builder 2016 workspace\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 workspace\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 but no dice 的响应。谢谢你的时间!