2.type Status report
message HTTP method GET is not supported by this URL
description The specified HTTP method is not allowed for the requested resource (HTTP


method GET is not supported by this URL).


访问时,一直报错:


type: Status report


message: HTTP method GET is not supported by this URL


description: The specified HTTP method is not allowed for the requested resource (HTTP


method GET is not supported by this URL).
经过上网查询,原因如下:


1,继承自HttpServlet的Servlet没有重写对于请求和响应的处理方法:doGet或doPost等方法;默认调


用父类的doGet或doPost等方法;


2,父类HttpServlet的doGet或doPost等方法覆盖了你重写的doGet或doPost等方法;


不管是1或2,父类HttpServlet的doGet或doPost等方法的默认实现是返回状态代码为405的HTTP错误表


示//
对于指定资源的请求方法不被允许。
解决方法:


1,子类重写doGet或doPost等方法;


2,在你扩展的Servlert中重写doGet或doPost等方法来处理请求和响应时 不要调用父类HttpServlet





doGet或doPost等方法,即去掉super.doGet(request, response)和super.doPost(request,


response);

更多相关文章

  1. 查看Android的appPackage和Activity的多种方法
  2. 【Android】ArrayList通过remove方法删除元素对象源码分析
  3. Android(安卓)琐碎知识点汇总
  4. Android之Kotlin入门:常量和静态方法
  5. Android之Drawable转换drawable、bitmap、byte[]
  6. Android(安卓)EditText的setOnEditorActionListener方法
  7. Android通过Apache HTTP访问HTTP资源
  8. Android(安卓)4.2 JellyBean Graphic Component -- SurfaceFling
  9. Android(安卓)SDK Manager下载和更新失败方法详解

随机推荐

  1. Android程序设计-刘刚-专题视频课程
  2. Android(安卓)BLE disconnect()和close()
  3. Android(安卓)TextView的图片和文字居中
  4. OnItemClickListener不响应
  5. DSBridge 更新公告:已支持 cocoapods 和 g
  6. Android中的Handler的post方法详解
  7. OpenGL ES for Android(安卓)环境搭建
  8. 自定义Activity栈来管理android的Activit
  9. android简单的手势判断
  10. unity调用aar包 适配AndroidX冲突