HTTP method GET is not supported by this URL
来源:互联网 发布:js toggleclass 编辑:程序博客网 时间:2024/06/15 19:43
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {// super.doGet(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {// super.doPost(req, resp); }
注释掉super部分代码
copy from http://stackoverflow.com/a/5370738/5001487
This is the default response of the default implementation of HttpServlet#doGet(). This means that the doGet() method is not properly being @Overriden, or it is explicitly being called.
You did properly @Override the doGet() method, but you’re still explicitly calling the default implementation for unclear reason.
super.doGet(req, resp);
Get rid of this line and this problem shall disappear.
The HttpServlet basically follows the template method pattern where all non-overridden HTTP methods returns this HTTP 405 error “Method not supported”. When you override such a method, you should not call super method, because you would otherwise still get the HTTP 405 error. The same story goes on for your doPost() method.
This also applies on service() by the way, but that does technically not harm in this construct since you need it to let the default implementation execute the proper methods. Actually, the whole service() method is unnecessary for you, you can just remove the entire method from your servlet.
The super.init(); is also unnecessary. It’s is only necessary when you override the init(ServletConfig), because otherwise the ServletConfig wouldn’t be set. This is also explicitly mentioned in the javadoc. It’s the only method which requires a super call.
Unrelated to the concrete problem, spawning a thread in a servlet like that is a bad idea. For the correct approach, head to How to run a background task in a servlet based web application?
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- 405 HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL 问题解决
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- Servelet:HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- 405: HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- 405--HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- HTTP method GET is not supported by this URL
- B
- Ubuntu16.10安装Lua5.3.4
- 安卓逆向工程与代码安全
- js基础运算符
- 电脑一直重复弹出adb.exe已停止工作
- HTTP method GET is not supported by this URL
- wechall php系列之Training: PHP LFI
- CUDA中grid、block、thread、warp与SM、SP的关系
- Oracle基本查询
- Android 获取mp4文件中任意时间点的帧图片(MediaMetadataRetriever )
- Android Studio自定义模板 做开发竟然可以如此轻松
- Qt——乱码最有效的解决办法
- 数据可视化
- mybatis+spring 整合配置延迟加载