HTTP状态405 - JSP只允许GET POST或HEAD [英] HTTP Status 405 - JSPs only permit GET POST or HEAD

查看:790
本文介绍了HTTP状态405 - JSP只允许GET POST或HEAD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于JSP 2.3(Tomcat 8)仅支持JSP的方法是GET POST或HEAD:



https://jcp.org/aboutJava/communityprocess/maintenance/jsr245/245-MR3.html
http://svn .apache.org / viewvc / tomcat / trunk / java / org / apache / jasper / servlet / JspServlet.java?view = diff& r1 = 1497877& r2 = 1497878& pathrev = 1497878

$ b但是,我想,这是一个很大的不兼容的变化,例如,对于异常处理程序,它用于转发到JSP,用于呈现异常和iso JSP视图,因为JSP 2.3响应是:

 方法不允许
HTTP状态405 - JSP只允许GET POST或HEAD

description所请求的资源不允许指定HTTP方法。
Apache Tomcat / 8.0.3

如果我们在异常情况下使用REST和Spring HandlerExceptionResolver我们肯定会碰到这个问题。这个问题有什么解决方法(iso更改http方法类型)?

解决方案

对不起,没有解决方法) 为了这。我对EG的建议是,处理的方法是可配置的。这个建议被拒绝。我建议你提出这个具体的问题,因为它是一个很好的参数,使得支持的方法可以基于每个JSP(或一组JSP)配置。



同时,我将看一下,使用某种形式的Tomcat特定配置,根据您为此提出的错误进行配置: https://issues.apache.org/bugzilla/show_bug.cgi?id=56568



更新:从Tomcat 8.0开始.9当使用JSP生成错误页面时,任何HTTP方法都将被允许。


Since JSP 2.3 (Tomcat 8) only supported method for JSP is GET POST or HEAD:

https://jcp.org/aboutJava/communityprocess/maintenance/jsr245/245-MR3.html http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java?view=diff&r1=1497877&r2=1497878&pathrev=1497878

But, I suppose, it is a big incompatible change as, for example, for exception handler it is used to forward to JSP for rendering exception and iso JSP view since JSP 2.3 response is:

Method Not Allowed
HTTP Status 405 - JSPs only permit GET POST or HEAD 

description The specified HTTP method is not allowed for the requested resource.
Apache Tomcat/8.0.3

If we use REST and Spring HandlerExceptionResolver in case of exception we bump into this problem for sure. Are there any workaround for this problem (iso change http method type)?

解决方案

Sorry, there is no workaround (at the moment) for this. My recommendation to the EG was that the handled methods were made configurable. That suggestion was rejected. I suggest you raise this specific issue with them since it is a good argument for making the supported methods configurable on a per JSP (or group of JSPs) basis.

Meanwhile, I'll take a look at making this configurable using some form of Tomcat specific configuration under the bug you raised for this: https://issues.apache.org/bugzilla/show_bug.cgi?id=56568

UPDATE: As of Tomcat 8.0.9 when a JSP is used to generate an error page, any HTTP method will be allowed.

这篇关于HTTP状态405 - JSP只允许GET POST或HEAD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆