Write a simple servlet, after the submission of the servlet will always report HTTP method The POST is not supported by the URL error, I was puzzled, in the BS development process has not encountered this kind of error, Baidu once also did not solve the problem, finally found in the rewrite of the Dopost added a statement super.dopost led, but under the Tomcat had to under the original code, After opening the Javax.servlet.http.HttpServlet.java file, the Dopost method for the superclass is found as follows:
protected void DoPost (HttpServletRequest req, HttpServletResponse resp)
& nbsp; throws Servletexception, IOException
{
String protocol = Req.getprotocol ();
String msg = lstrings.getstring ("Http.method_post_not_ Supported ");
if (Protocol.endswith ("1.1")) {
Resp.senderror (httpservletresponse.sc_method_not_allowed, msg);
} else {
Resp.senderror (Httpservletresponse.sc_bad_request, msg);
}
}
In other words, regardless of your HTTP is not 1.1, are using the Resp.senderror method to return a http.method_post_not_supported error message to the front interface, put me in good pain, strongly condemn the Tomcat code comments, Should be noted do not add super.dopost, can not always let us see your source code it. hehe.
Source: http://hi.baidu.com/winlei/item/cdd3000da3224eca9057181b