gpt4 book ai didi

coldfusion - REST Web 服务 404 未找到 - ColdFusion 11

转载 作者:行者123 更新时间:2023-12-02 18:48:05 26 4
gpt4 key购买 nike

我在现有的 REST cfc 中创建了一个新函数,但当我尝试调用它时,我收到 404 错误,而其余函数正在运行。所有功能都遵循与我将要进一步链接的功能相同的结构,没有任何问题。

我看到了另一个像我一样的帖子,但我没有在其中找到任何答案。这是另一篇文章的链接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>

这就是我所说的

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

当我尝试直接在浏览器中调用该函数时,我收到了预期的结果。

此外,每次我对组件进行更改时,我都会使用此函数重置 REST 服务,到目前为止,它似乎按预期工作。

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

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

最佳答案

This is a browser limitation :

Microsoft Internet Explorer has a maximum uniform resource locator (URL) length of 2,083 characters. Internet Explorer also has a maximum path length of 2,048 characters. This limit applies to both POST request and GET request URLs.

If you are using the GET method, you are limited to a maximum of 2,048 characters, minus the number of characters in the actual path.

However, the POST method is not limited by the size of the URL for submitting name/value pairs. These pairs are transferred in the header and not in the URL.

RFC 2616, "Hypertext Transfer Protocol -- HTTP/1.1," does not specify any requirement for URL length.

关于coldfusion - REST Web 服务 404 未找到 - ColdFusion 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28178485/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com