How to configure tomcat to support http delete and put

WebDAV (Web-based Distributed Authoring and Versioning) is a communication protocol based on HTTP 1.1. It adds some extensions to HTTP 1.1 (that is, adding some new methods in addition to several HTTP standard methods such as GET, POST, HEAD, etc.), so that applications can directly write files to the Web Server, and can write files when writing files. Lock the file, unlock the file after writing, and also support the version control of the file. The emergence of this protocol has greatly increased the value of the Web to us as a creative medium. A powerful content management system or configuration management system can be implemented based on WebDAV.

method:

PUT, upload additional files to the specified directory;

DELETE, delete the specified resource;

COPY, copy the specified resource to the location specified in the Destination message header;

MOVE, move the specified resource to the location specified by the Destination message header;

SEARCH, searches for resources in a directory path.

PROPFIND Get information about the specified resource, such as author, size, and content type.

TRACE, which returns the original request received by the server in the response. Defenses against cross-site scripting can be circumvented using this method.

Support http delete and put methods in tomcat5.5:

Configure org.apache.catalina.servlets.DefaultServlet in tomcat web.xml file 

<servlet>
           <servlet-name>default</servlet-name>
           <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
           <init-param>
               <param-name>debug</param-name>
               <param-value>0</param-value>
           </init-param>
           <init-param>
               <param-name>readonly</param-name>
               <param-value>true</param-value>
           </init-param>
           <init-param>
               <param-name>listings</param-name>
               <param-value>false</param-value>
           </init-param>
           <load-on-startup>1</load-on-startup>
</servlet>

 The readonly parameter defaults to true, that is, delete and put operations are not allowed, so access through the put or delete methods of the XMLHttpRequest object will report an http 403 error. For REST services, this property should be set to false.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326224089&siteId=291194637