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>
creationDateFormat
A ThreadLocal for simple date format for the creation date ISO representation (partial).protected static String
DEFAULT_NAMESPACE
Default namespace.protected static MD5Encoder
md5Encoder
The MD5 helper object for this class.protected static MessageDigest
md5Helper
MD5 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 boolean
checkIfHeaders(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 void
doCopy(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
COPY Method.protected void
doDelete(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
DELETE Method.protected void
doLock(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
LOCK Method.protected void
doMkcol(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
MKCOL Method.protected void
doMove(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
MOVE Method.protected void
doOptions(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
OPTIONS Method.protected void
doPropfind(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
PROPFIND Method.protected void
doProppatch(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
PROPPATCH Method.protected void
doPut(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
Process a POST request for the specified resource.protected void
doUnlock(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)
UNLOCK Method.protected DocumentBuilder
getDocumentBuilder()
Return JAXP document builder instance.protected String
getRelativePath(jakarta.servlet.http.HttpServletRequest request)
Override the DefaultServlet implementation and only use the PathInfo.void
init()
Initialize this servlet.protected void
service(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.ServletException
Initialize this servlet.- Overrides:
init
in 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, IOException
Handles the special WebDAV methods.- Overrides:
service
in classjakarta.servlet.http.HttpServlet
- Throws:
jakarta.servlet.ServletException
IOException
-
checkIfHeaders
protected boolean checkIfHeaders(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, ResourceAttributes resourceAttributes) throws IOException
Check if the conditions specified in the optional If headers are satisfied.- Overrides:
checkIfHeaders
in 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:
getRelativePath
in 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, IOException
OPTIONS Method.- Overrides:
doOptions
in 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, IOException
PROPFIND Method.- Throws:
jakarta.servlet.ServletException
IOException
-
doProppatch
protected void doProppatch(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException
PROPPATCH Method.- Throws:
jakarta.servlet.ServletException
IOException
-
doMkcol
protected void doMkcol(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException
MKCOL Method.- Throws:
jakarta.servlet.ServletException
IOException
-
doDelete
protected void doDelete(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException
DELETE Method.- Overrides:
doDelete
in 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, IOException
Process a POST request for the specified resource.- Overrides:
doPut
in 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, IOException
COPY Method.- Throws:
jakarta.servlet.ServletException
IOException
-
doMove
protected void doMove(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException
MOVE Method.- Throws:
jakarta.servlet.ServletException
IOException
-
doLock
protected void doLock(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException
LOCK Method.- Throws:
jakarta.servlet.ServletException
IOException
-
doUnlock
protected void doUnlock(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws jakarta.servlet.ServletException, IOException
UNLOCK Method.- Throws:
jakarta.servlet.ServletException
IOException
-
-