Package org.apache.catalina.servlets
Class WebdavServlet
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.apache.catalina.servlets.DefaultServlet
org.apache.catalina.servlets.WebdavServlet
- All Implemented Interfaces:
- Servlet,- ServletConfig,- Serializable
Servlet which adds support for WebDAV
 level 2. All the basic HTTP requests are handled by the
 DefaultServlet. The WebDAVServlet must not be used as the default servlet (ie mapped to '/') as it will not work in
 this configuration.
 
 Mapping a subpath (e.g. /webdav/* to this servlet has the effect of re-mounting the entire web
 application under that sub-path, with WebDAV access to all the resources. The WEB-INF and
 META-INF directories are protected in this re-mounted resource tree.
 
To enable WebDAV for a context add the following to web.xml:
 <servlet>
  <servlet-name>webdav</servlet-name>
  <servlet-class>org.apache.catalina.servlets.WebdavServlet</servlet-class>
    <init-param>
      <param-name>debug</param-name>
      <param-value>0</param-value>
    </init-param>
    <init-param>
      <param-name>listings</param-name>
      <param-value>false</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>webdav</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping>
 
 This will enable read only access. To enable read-write access add:
 
  <init-param>
    <param-name>readonly</param-name>
    <param-value>false</param-value>
  </init-param>
 
 To make the content editable via a different URL, use the following mapping:
 
  <servlet-mapping>
    <servlet-name>webdav</servlet-name>
    <url-pattern>/webdavedit/*</url-pattern>
  </servlet-mapping>
 
 By default access to /WEB-INF and META-INF are not available via WebDAV. To enable access to these URLs, use add:
 
  <init-param>
    <param-name>allowSpecialPaths</param-name>
    <param-value>true</param-value>
  </init-param>
 
 Don't forget to secure access appropriately to the editing URLs, especially if allowSpecialPaths is used. With the
 mapping configuration above, the context will be accessible to normal users as before. Those users with the necessary
 access will be able to edit content available via http://host:port/context/content using
 http://host:port/context/webdavedit/content- Author:
- Remy Maucherat
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.catalina.servlets.DefaultServletDefaultServlet.CompressionFormat
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final ConcurrentDateFormatSimple date format for the creation date ISO representation (partial).protected static final StringDefault namespace.Fields inherited from class org.apache.catalina.servlets.DefaultServletBUFFER_SIZE, compressionFormats, contextXsltFile, debug, fileEncoding, FULL, globalXsltFile, input, listings, localXsltFile, mimeSeparation, output, readmeFile, readOnly, resources, sendfileSize, showServerInfo, sm, sortListings, sortManager, useAcceptRangesFields inherited from class jakarta.servlet.http.HttpServletLEGACY_DO_HEAD
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected booleancheckIfHeaders(HttpServletRequest request, HttpServletResponse response, WebResource resource) Check if the conditions specified in the optional If headers are satisfied.protected StringDetermines the methods normally allowed for the resource.protected voiddoCopy(HttpServletRequest req, HttpServletResponse resp) COPY Method.protected voiddoDelete(HttpServletRequest req, HttpServletResponse resp) DELETE Method.protected voiddoLock(HttpServletRequest req, HttpServletResponse resp) LOCK Method.protected voiddoMkcol(HttpServletRequest req, HttpServletResponse resp) MKCOL Method.protected voiddoMove(HttpServletRequest req, HttpServletResponse resp) MOVE Method.protected voiddoOptions(HttpServletRequest req, HttpServletResponse resp) OPTIONS Method.protected voiddoPropfind(HttpServletRequest req, HttpServletResponse resp) PROPFIND Method.protected voiddoProppatch(HttpServletRequest req, HttpServletResponse resp) PROPPATCH Method.protected voiddoPut(HttpServletRequest req, HttpServletResponse resp) Process a PUT request for the specified resource.protected voiddoUnlock(HttpServletRequest req, HttpServletResponse resp) UNLOCK Method.protected DocumentBuilderReturn JAXP document builder instance.protected StringgetPathPrefix(HttpServletRequest request) Determines the prefix for standard directory GET listings.protected StringgetRelativePath(HttpServletRequest request) Override the DefaultServlet implementation and only use the PathInfo.protected StringgetRelativePath(HttpServletRequest request, boolean allowEmptyPath) voidinit()Initialize this servlet.protected voidservice(HttpServletRequest req, HttpServletResponse resp) Handles the special WebDAV methods.Methods inherited from class org.apache.catalina.servlets.DefaultServletcheckIfMatch, checkIfModifiedSince, checkIfNoneMatch, checkIfUnmodifiedSince, checkSendfile, copy, copy, copy, copy, copyRange, copyRange, copyRange, destroy, doGet, doHead, doPost, executePartialPut, findXsltSource, generateETag, getReadme, parseContentRange, parseRange, render, renderHtml, renderSize, renderXml, rewriteUrl, sendNotAllowed, serveResourceMethods inherited from class jakarta.servlet.http.HttpServletdoTrace, getLastModified, init, serviceMethods inherited from class jakarta.servlet.GenericServletgetInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, log, log
- 
Field Details- 
DEFAULT_NAMESPACEDefault namespace.- See Also:
 
- 
creationDateFormatSimple date format for the creation date ISO representation (partial).
 
- 
- 
Constructor Details- 
WebdavServletpublic WebdavServlet()
 
- 
- 
Method Details- 
initInitialize this servlet.- Overrides:
- initin class- DefaultServlet
- Throws:
- ServletException- if an exception occurs that interrupts the servlet's normal operation
 
- 
getDocumentBuilderReturn JAXP document builder instance.- Returns:
- the document builder
- Throws:
- ServletException- document builder creation failed (wrapped- ParserConfigurationExceptionexception)
 
- 
serviceprotected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException Handles the special WebDAV methods.- Overrides:
- servicein class- DefaultServlet
- Parameters:
- req- the- HttpServletRequestobject that contains the request the client made of the servlet
- resp- the- HttpServletResponseobject that contains the response the servlet returns to the client
- Throws:
- ServletException- if the HTTP request cannot be handled
- IOException- if an input or output error occurs while the servlet is handling the HTTP request
- See Also:
 
- 
checkIfHeadersprotected boolean checkIfHeaders(HttpServletRequest request, HttpServletResponse response, WebResource resource) throws IOException Description copied from class:DefaultServletCheck if the conditions specified in the optional If headers are satisfied.- Overrides:
- checkIfHeadersin class- DefaultServlet
- Parameters:
- request- The servlet request we are processing
- response- The servlet response we are creating
- resource- The resource
- Returns:
- trueif the resource meets all the specified conditions, and- falseif any of the conditions is not satisfied, in which case request processing is stopped
- Throws:
- IOException- an IO error occurred
 
- 
getRelativePathOverride the DefaultServlet implementation and only use the PathInfo. If the ServletPath is non-null, it will be because the WebDAV servlet has been mapped to a url other than /* to configure editing at different url than normal viewing.- Overrides:
- getRelativePathin class- DefaultServlet
- Parameters:
- request- The servlet request we are processing
- Returns:
- the relative path
 
- 
getRelativePath- Overrides:
- getRelativePathin class- DefaultServlet
 
- 
getPathPrefixDetermines the prefix for standard directory GET listings.- Overrides:
- getPathPrefixin class- DefaultServlet
- Parameters:
- request- the request to determine the path for
- Returns:
- the prefix to apply to all resources in the listing.
 
- 
doOptionsprotected void doOptions(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException OPTIONS Method.- Overrides:
- doOptionsin class- DefaultServlet
- Parameters:
- req- The Servlet request
- resp- The Servlet response
- Throws:
- ServletException- If an error occurs
- IOException- If an IO error occurs
 
- 
doPropfindprotected void doPropfind(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException PROPFIND Method.- Parameters:
- req- The Servlet request
- resp- The Servlet response
- Throws:
- ServletException- If an error occurs
- IOException- If an IO error occurs
 
- 
doProppatchPROPPATCH Method.- Parameters:
- req- The Servlet request
- resp- The Servlet response
- Throws:
- IOException- If an IO error occurs
 
- 
doMkcolprotected void doMkcol(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException MKCOL Method.- Parameters:
- req- The Servlet request
- resp- The Servlet response
- Throws:
- ServletException- If an error occurs
- IOException- If an IO error occurs
 
- 
doDeleteprotected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException DELETE Method.- Overrides:
- doDeletein class- DefaultServlet
- Parameters:
- req- The Servlet request
- resp- The Servlet response
- Throws:
- ServletException- If an error occurs
- IOException- If an IO error occurs
 
- 
doPutprotected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException Process a PUT request for the specified resource.- Overrides:
- doPutin class- DefaultServlet
- Parameters:
- req- The servlet request we are processing
- resp- The servlet response we are creating
- Throws:
- IOException- if an input/output error occurs
- ServletException- if a servlet-specified error occurs
 
- 
doCopyCOPY Method.- Parameters:
- req- The Servlet request
- resp- The Servlet response
- Throws:
- IOException- If an IO error occurs
 
- 
doMoveMOVE Method.- Parameters:
- req- The Servlet request
- resp- The Servlet response
- Throws:
- IOException- If an IO error occurs
 
- 
doLockprotected void doLock(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException LOCK Method.- Parameters:
- req- The Servlet request
- resp- The Servlet response
- Throws:
- ServletException- If an error occurs
- IOException- If an IO error occurs
 
- 
doUnlockUNLOCK Method.- Parameters:
- req- The Servlet request
- resp- The Servlet response
- Throws:
- IOException- If an IO error occurs
 
- 
determineMethodsAllowedDetermines the methods normally allowed for the resource.- Overrides:
- determineMethodsAllowedin class- DefaultServlet
- Parameters:
- req- The Servlet request
- Returns:
- The allowed HTTP methods
 
 
-