标签:toc over ... cte 自定义 test support protocol 删掉
自定义servlet
public class TestServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { super.doGet(req, resp); } }
HttpServlet里的doGet方法是这样定义的
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String protocol = req.getProtocol(); String msg = lStrings.getString("http.method_get_not_supported"); if (protocol.endsWith("1.1")) { resp.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, msg); } else { resp.sendError(HttpServletResponse.SC_BAD_REQUEST, msg); } }
所以重写doGet/doPost方法时,必须先将super.doGet(...)/super.doPost(...)删掉
自定义servlet重写doGet或者doPost方法时,405 method not allowed
标签:toc over ... cte 自定义 test support protocol 删掉
原文地址:https://www.cnblogs.com/qf123/p/10114012.html