public class WebdavServlet extends DefaultServlet
<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>true</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, using the following
mapping:
<servlet-mapping>
<servlet-name>webdav</servlet-name>
<url-pattern>/webdavedit/*</url-pattern>
</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/contentDefaultServlet.Range| Modifier and Type | Field and 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.
|
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 and Description |
|---|
WebdavServlet() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkIfHeaders(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ResourceAttributes resourceAttributes)
Check if the conditions specified in the optional If headers are
satisfied.
|
protected void |
doCopy(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
COPY Method.
|
protected void |
doDelete(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
DELETE Method.
|
protected void |
doLock(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
LOCK Method.
|
protected void |
doMkcol(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
MKCOL Method.
|
protected void |
doMove(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
MOVE Method.
|
protected void |
doOptions(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
OPTIONS Method.
|
protected void |
doPropfind(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
PROPFIND Method.
|
protected void |
doProppatch(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
PROPPATCH Method.
|
protected void |
doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Process a POST request for the specified resource.
|
protected void |
doUnlock(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
UNLOCK Method.
|
protected DocumentBuilder |
getDocumentBuilder()
Return JAXP document builder instance.
|
protected String |
getRelativePath(javax.servlet.http.HttpServletRequest request)
Override the DefaultServlet implementation and only use the PathInfo.
|
void |
init()
Initialize this servlet.
|
protected void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Handles the special WebDAV methods.
|
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, setListingsprotected static final String DEFAULT_NAMESPACE
protected static final ThreadLocal<SimpleDateFormat> creationDateFormat
protected static final MessageDigest md5Helper
protected static final MD5Encoder md5Encoder
public void init()
throws javax.servlet.ServletException
init in class DefaultServletjavax.servlet.ServletExceptionprotected DocumentBuilder getDocumentBuilder() throws javax.servlet.ServletException
javax.servlet.ServletExceptionprotected void service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
service in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionprotected boolean checkIfHeaders(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
ResourceAttributes resourceAttributes)
throws IOException
checkIfHeaders in class DefaultServletrequest - The servlet request we are processingresponse - The servlet response we are creatingresourceAttributes - The resource informationIOExceptionprotected String getRelativePath(javax.servlet.http.HttpServletRequest request)
getRelativePath in class DefaultServletrequest - The servlet request we are processingprotected void doOptions(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
doOptions in class javax.servlet.http.HttpServletreq - The requestresp - The responsejavax.servlet.ServletException - If an error occursIOException - If an IO error occursprotected void doPropfind(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
javax.servlet.ServletExceptionIOExceptionprotected void doProppatch(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
javax.servlet.ServletExceptionIOExceptionprotected void doMkcol(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
javax.servlet.ServletExceptionIOExceptionprotected void doDelete(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
doDelete in class DefaultServletreq - The servlet request we are processingresp - The servlet response we are creatingjavax.servlet.ServletException - if a servlet-specified error occursIOException - if an input/output error occursprotected void doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
doPut in class DefaultServletreq - The servlet request we are processingresp - The servlet response we are creatingIOException - if an input/output error occursjavax.servlet.ServletException - if a servlet-specified error occursprotected void doCopy(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
javax.servlet.ServletExceptionIOExceptionprotected void doMove(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
javax.servlet.ServletExceptionIOExceptionprotected void doLock(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
javax.servlet.ServletExceptionIOExceptionprotected void doUnlock(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
javax.servlet.ServletExceptionIOExceptionCopyright © 2017. All rights reserved.