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:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
public class WebdavServlet extends DefaultServlet
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. To enable WebDAV for a context add the following to web.xml:<servlet>This will enable read only access. To enable read-write access add:
<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>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>webdav</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<init-param>To make the content editable via a different URL, using the following mapping:
<param-name>readonly</param-name>
<param-value>false</param-value>
</init-param>
<servlet-mapping>Don't forget to secure access appropriately to the editing URLs. With this configuration 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
<servlet-name>webdav</servlet-name>
<url-pattern>/webdavedit/*</url-pattern>
</servlet-mapping>- Version:
- $Revision: 600268 $ $Date: 2007-12-02 12:09:55 +0100 $
- Author:
- Remy Maucherat
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.catalina.servlets.DefaultServlet
DefaultServlet.Range
-
-
Field Summary
Fields Modifier and Type Field Description protected static ThreadLocal<SimpleDateFormat>creationDateFormatA ThreadLocal for simple date format for the creation date ISO representation (partial).protected static StringDEFAULT_NAMESPACEDefault namespace.protected static MD5Encodermd5EncoderThe MD5 helper object for this class.protected static MessageDigestmd5HelperMD5 message digest provider.-
Fields inherited from class org.apache.catalina.servlets.DefaultServlet
alternateDocBases, BUFFER_SIZE, contextXsltFile, debug, fileEncoding, FULL, globalXsltFile, input, listings, localXsltFile, maxHeaderRangeItems, mimeSeparation, output, rb, readmeFile, readOnly, resources, RESOURCES_JNDI_NAME, sendfileSize, sortedBy, urlEncoder, useAcceptRanges
-
-
Constructor Summary
Constructors Constructor Description WebdavServlet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckIfHeaders(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, ResourceAttributes resourceAttributes)Check if the conditions specified in the optional If headers are satisfied.protected voiddoCopy(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)COPY Method.protected voiddoDelete(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)DELETE Method.protected voiddoLock(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)LOCK Method.protected voiddoMkcol(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)MKCOL Method.protected voiddoMove(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)MOVE Method.protected voiddoOptions(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)OPTIONS Method.protected voiddoPropfind(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)PROPFIND Method.protected voiddoProppatch(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)PROPPATCH Method.protected voiddoPut(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)Process a POST request for the specified resource.protected voiddoUnlock(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)UNLOCK Method.protected DocumentBuildergetDocumentBuilder()Return JAXP document builder instance.protected StringgetRelativePath(jakarta.servlet.http.HttpServletRequest request)Override the DefaultServlet implementation and only use the PathInfo.voidinit()Initialize this servlet.protected voidservice(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)Handles the special WebDAV methods.-
Methods inherited from class org.apache.catalina.servlets.DefaultServlet
checkIfMatch, checkIfModifiedSince, checkIfNoneMatch, checkIfUnmodifiedSince, checkSendfile, copy, copy, copy, copy, copy, copy, copyRange, copyRange, copyRange, copyRange, destroy, displaySize, doGet, doHead, doPost, executePartialPut, findXsltInputStream, getReadme, isListings, parseContentRange, parseRange, render, renderHtml, renderSize, renderXml, rewriteUrl, serveResource, setListings
-
Methods inherited from class jakarta.servlet.http.HttpServlet
doTrace, getLastModified, init, service
-
-
-
-
Field Detail
-
DEFAULT_NAMESPACE
protected static final String DEFAULT_NAMESPACE
Default namespace.- See Also:
- Constant Field Values
-
creationDateFormat
protected static final ThreadLocal<SimpleDateFormat> creationDateFormat
A ThreadLocal for simple date format for the creation date ISO representation (partial).
-
md5Helper
protected static final MessageDigest md5Helper
MD5 message digest provider.
-
md5Encoder
protected static final MD5Encoder md5Encoder
The MD5 helper object for this class.
-
-
Method Detail
-
init
public void init() throws jakarta.servlet.ServletExceptionInitialize this servlet.- Overrides:
initin classDefaultServlet- Throws:
jakarta.servlet.ServletException
-
getDocumentBuilder
protected DocumentBuilder getDocumentBuilder() throws jakarta.servlet.ServletException
Return JAXP document builder instance.- Throws:
jakarta.servlet.ServletException
-
service
protected void service(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOExceptionHandles the special WebDAV methods.- Overrides:
servicein classjakarta.servlet.http.HttpServlet- Throws:
jakarta.servlet.ServletExceptionIOException
-
checkIfHeaders
protected boolean checkIfHeaders(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, ResourceAttributes resourceAttributes) throws IOExceptionCheck if the conditions specified in the optional If headers are satisfied.- Overrides:
checkIfHeadersin classDefaultServlet- Parameters:
request- The servlet request we are processingresponse- The servlet response we are creatingresourceAttributes- The resource information- Returns:
- boolean true if the resource meets all the specified conditions, and false if any of the conditions is not satisfied, in which case request processing is stopped
- Throws:
IOException
-
getRelativePath
protected String getRelativePath(jakarta.servlet.http.HttpServletRequest request)
Override 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 classDefaultServlet- Parameters:
request- The servlet request we are processing
-
doOptions
protected void doOptions(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOExceptionOPTIONS Method.- Overrides:
doOptionsin classjakarta.servlet.http.HttpServlet- Parameters:
req- The requestresp- The response- Throws:
jakarta.servlet.ServletException- If an error occursIOException- If an IO error occurs
-
doPropfind
protected void doPropfind(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOExceptionPROPFIND Method.- Throws:
jakarta.servlet.ServletExceptionIOException
-
doProppatch
protected void doProppatch(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOExceptionPROPPATCH Method.- Throws:
jakarta.servlet.ServletExceptionIOException
-
doMkcol
protected void doMkcol(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOExceptionMKCOL Method.- Throws:
jakarta.servlet.ServletExceptionIOException
-
doDelete
protected void doDelete(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOExceptionDELETE Method.- Overrides:
doDeletein classDefaultServlet- Parameters:
req- The servlet request we are processingresp- The servlet response we are creating- Throws:
jakarta.servlet.ServletException- if a servlet-specified error occursIOException- if an input/output error occurs
-
doPut
protected void doPut(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOExceptionProcess a POST request for the specified resource.- Overrides:
doPutin classDefaultServlet- Parameters:
req- The servlet request we are processingresp- The servlet response we are creating- Throws:
IOException- if an input/output error occursjakarta.servlet.ServletException- if a servlet-specified error occurs
-
doCopy
protected void doCopy(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOExceptionCOPY Method.- Throws:
jakarta.servlet.ServletExceptionIOException
-
doMove
protected void doMove(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOExceptionMOVE Method.- Throws:
jakarta.servlet.ServletExceptionIOException
-
doLock
protected void doLock(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOExceptionLOCK Method.- Throws:
jakarta.servlet.ServletExceptionIOException
-
doUnlock
protected void doUnlock(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOExceptionUNLOCK Method.- Throws:
jakarta.servlet.ServletExceptionIOException
-
-