How to make Apache Tomcat accept DELETE method

前端 未结 4 1874
走了就别回头了
走了就别回头了 2020-12-06 02:23

I\'m working on a project of RESTful web services, i\'m using Apache Tomcat and JAX-RS.

I want to accept DELETE requests from client but whenever i send a DELETE req

4条回答
  •  不知归路
    2020-12-06 02:41

    Here are the reasons why you can get a 403 Forbidden from Tomcat for a DELETE request:

    On each HTTP DELETE request processed by this servlet, the following processing shall be performed:

    • If modifications to the static resources are not allowed (set by a configuration parameter), return HTTP status 403 (forbidden).

    • If an attempt is made to delete a resource from /META-INF or /WEB-INF, return HTTP status 403 (forbidden).

    • If the requested resource does not exist, return HTTP status 404 (not found)

    • Unbind the resource from the directory context containing the static resources for this web application. If successful, return HTTP status 204 (no content). Otherwise, return HTTP status 405 (method not allowed).

    Source: http://tomcat.apache.org/tomcat-5.5-doc/catalina/funcspecs/fs-default.html

    Make sure you adhere to the tomcat specifications to avoid any problem.

提交回复
热议问题