3

I created a new function in an existing REST cfc but when I am trying to call it I receive a 404 Error where the rest of the functions are working. All of the functions are following the same structure as the one I am about to link further down without any issues.

I saw another post like mine but I didn't find any answers in it. This is the link for the other post here

<cfcomponent restpath="student" rest="true">
<cffunction name="npssummary" access="remote" output="false" returntype="any" httpmethod="get" restpath="npssummary" produces="application/json">   

        <cfquery name="nps_summary" datasource="dpsigweb2">
            select top 10 * from contact
        </cfquery>

        <cfreturn serializeJSON(nps_summary,"struct")>

  </cffunction>
</cfcomponent>

And this is how I am calling it

<cfhttp url="http://dev.example.com/rest/IIT/student/npssummary" method="get">
<cfset results = "#cfhttp#">
<cfdump var="#results#">

When I am trying to call the function directly in the browser I receive the expected result.

Also, I am using this function to reset the REST services each time I make a change to my component it seems to be working as expected so far.

<cftry>
<cfset restInitApplication("Z:\Sites\testSites\API\","IIT")>

<cfcatch type="any">
    <cfdump var="#cfcatch#">
</cfcatch>
</cftry>
4

1 回答 1

1

这是浏览器限制

Microsoft Internet Explorer 的最大统一资源定位符 (URL) 长度为 2,083 个字符。Internet Explorer 的最大路径长度也为 2,048 个字符。此限制适用于 POST 请求和 GET 请求 URL。

如果您使用 GET 方法,则限制为最多 2,048 个字符,减去实际路径中的字符数。

但是,POST 方法不受用于提交名称/值对的 URL 大小的限制。这些对在标头中传输,而不是在 URL 中。

RFC 2616,“超文本传输​​协议——HTTP/1.1”,没有指定对 URL 长度的任何要求。

于 2015-01-28T15:50:50.183 回答