在第三方服务器中,当使用EXt-JS 4的Web应用程序(服务器端和Struts 2)发出与内容类型的Ajax请求时:application/json; charset = utf-8 webserver返回页面未找到http 404/403状态码。但是,如果我们通过浏览器网址栏使用纯文本/ html发出相同的请求,则会收到响应。会有什么问题。内容类型json返回http 404
有任何方法来模拟由在不同的内容类型发送请求,我试图下面的HTML形式,但它仅发送内容类型:应用/ X WWW的窗体-urlencoded
<html>
<body>
<form action="http://abc.com/abc?" method="post" enctype="application/json; charset=utf-8">
<input type='submit'/>
</form>
</body>
</html>
服务器或tomcat可以单独限制特定的内容类型吗?
<action name="abc" class="com.stutzen.rhs.abc.Abc" method="abc">
<interceptor-ref name="json">
<!--param name="contentType">application/json</param-->
</interceptor-ref>
<result type="json">
<param name="excludeProperties">
data,model
</param>
</result>
</action>
当然,服务器可以分析请求头并根据它找到的内容返回响应。 – zb226 2012-08-11 09:13:30