net.sf.webdav
Class WebdavServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended bynet.sf.webdav.WebdavServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class WebdavServlet
extends javax.servlet.http.HttpServlet

Servlet which provides support for WebDAV level 2. the original class is org.apache.catalina.servlets.WebdavServlet by Remy Maucherat, which was heavily changed

Author:
Remy Maucherat
See Also:
Serialized Form

Field Summary
protected static java.text.SimpleDateFormat creationDateFormat
          Simple date format for the creation date ISO representation (partial).
protected static java.lang.String DEFAULT_NAMESPACE
          Default namespace.
protected static MD5Encoder md5Encoder
          The MD5 helper object for this class.
protected static java.security.MessageDigest md5Helper
          MD5 message digest provider.
protected static URLEncoder urlEncoder
          Array containing the safe characters set.
 
Constructor Summary
WebdavServlet()
           
 
Method Summary
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 doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, boolean includeBody)
          GET Method
protected  void doHead(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          HEAD 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  java.lang.String getETag(java.lang.String path, java.lang.String resourceLength, java.lang.String lastModified)
          Get the ETag associated with a file.
protected  java.lang.String getRelativePath(javax.servlet.http.HttpServletRequest request)
          Return the relative path associated with this servlet.
 void init()
          Initialize this servlet.
protected  java.lang.String normalize(java.lang.String path)
          Return a context-relative path, beginning with a "/", that represents the canonical version of the specified path after ".." and "." elements are resolved out.
protected  java.lang.String rewriteUrl(java.lang.String path)
          URL rewriter.
protected  void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Handles the special WebDAV methods.
 
Methods inherited from class javax.servlet.http.HttpServlet
doGet, doPost, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

md5Helper

protected static java.security.MessageDigest md5Helper
MD5 message digest provider.


md5Encoder

protected static final MD5Encoder md5Encoder
The MD5 helper object for this class.


DEFAULT_NAMESPACE

protected static final java.lang.String DEFAULT_NAMESPACE
Default namespace.

See Also:
Constant Field Values

creationDateFormat

protected static final java.text.SimpleDateFormat creationDateFormat
Simple date format for the creation date ISO representation (partial).


urlEncoder

protected static URLEncoder urlEncoder
Array containing the safe characters set.

Constructor Detail

WebdavServlet

public WebdavServlet()
Method Detail

init

public void init()
          throws javax.servlet.ServletException
Initialize this servlet.

Throws:
javax.servlet.ServletException

service

protected void service(javax.servlet.http.HttpServletRequest req,
                       javax.servlet.http.HttpServletResponse resp)
                throws javax.servlet.ServletException,
                       java.io.IOException
Handles the special WebDAV methods.

Throws:
javax.servlet.ServletException
java.io.IOException

getRelativePath

protected java.lang.String getRelativePath(javax.servlet.http.HttpServletRequest request)
Return the relative path associated with this servlet.

Parameters:
request - The servlet request we are processing

doOptions

protected void doOptions(javax.servlet.http.HttpServletRequest req,
                         javax.servlet.http.HttpServletResponse resp)
                  throws javax.servlet.ServletException,
                         java.io.IOException
OPTIONS Method.

Parameters:
req - HttpServletRequest
resp - HttpServletResponse
Throws:
javax.servlet.ServletException
java.io.IOException

doPropfind

protected void doPropfind(javax.servlet.http.HttpServletRequest req,
                          javax.servlet.http.HttpServletResponse resp)
                   throws javax.servlet.ServletException,
                          java.io.IOException
PROPFIND Method.

Parameters:
req - HttpServletRequest
resp - HttpServletResponse
Throws:
javax.servlet.ServletException
java.io.IOException

doProppatch

protected void doProppatch(javax.servlet.http.HttpServletRequest req,
                           javax.servlet.http.HttpServletResponse resp)
                    throws javax.servlet.ServletException,
                           java.io.IOException
PROPPATCH Method.

Parameters:
req - HttpServletRequest
resp - HttpServletResponse
Throws:
javax.servlet.ServletException
java.io.IOException

doGet

protected void doGet(javax.servlet.http.HttpServletRequest req,
                     javax.servlet.http.HttpServletResponse resp,
                     boolean includeBody)
              throws javax.servlet.ServletException,
                     java.io.IOException
GET Method

Parameters:
req - HttpServletRequest
resp - HttpServletResponse
Throws:
javax.servlet.ServletException
java.io.IOException

doHead

protected void doHead(javax.servlet.http.HttpServletRequest req,
                      javax.servlet.http.HttpServletResponse resp)
               throws javax.servlet.ServletException,
                      java.io.IOException
HEAD Method.

Parameters:
req - HttpServletRequest
resp - HttpServletResponse
Throws:
javax.servlet.ServletException
java.io.IOException

doMkcol

protected void doMkcol(javax.servlet.http.HttpServletRequest req,
                       javax.servlet.http.HttpServletResponse resp)
                throws javax.servlet.ServletException,
                       java.io.IOException
MKCOL Method.

Parameters:
req - HttpServletRequest
resp - HttpServletResponse
Throws:
javax.servlet.ServletException
java.io.IOException

doDelete

protected void doDelete(javax.servlet.http.HttpServletRequest req,
                        javax.servlet.http.HttpServletResponse resp)
                 throws javax.servlet.ServletException,
                        java.io.IOException
DELETE Method.

Parameters:
req - HttpServletRequest
resp - HttpServletResponse
Throws:
javax.servlet.ServletException
java.io.IOException

doPut

protected void doPut(javax.servlet.http.HttpServletRequest req,
                     javax.servlet.http.HttpServletResponse resp)
              throws javax.servlet.ServletException,
                     java.io.IOException
Process a POST request for the specified resource.

Parameters:
req - The servlet request we are processing
resp - The servlet response we are creating
Throws:
java.io.IOException - if an input/output error occurs
javax.servlet.ServletException - if a servlet-specified error occurs

doCopy

protected void doCopy(javax.servlet.http.HttpServletRequest req,
                      javax.servlet.http.HttpServletResponse resp)
               throws javax.servlet.ServletException,
                      java.io.IOException
COPY Method.

Parameters:
req - HttpServletRequest
resp - HttpServletResponse
Throws:
javax.servlet.ServletException
java.io.IOException

doMove

protected void doMove(javax.servlet.http.HttpServletRequest req,
                      javax.servlet.http.HttpServletResponse resp)
               throws javax.servlet.ServletException,
                      java.io.IOException
MOVE Method.

Parameters:
req - HttpServletRequest
resp - HttpServletResponse
Throws:
javax.servlet.ServletException
java.io.IOException

normalize

protected java.lang.String normalize(java.lang.String path)
Return a context-relative path, beginning with a "/", that represents the canonical version of the specified path after ".." and "." elements are resolved out. If the specified path attempts to go outside the boundaries of the current context (i.e. too many ".." path elements are present), return null instead.

Parameters:
path - Path to be normalized

getETag

protected java.lang.String getETag(java.lang.String path,
                                   java.lang.String resourceLength,
                                   java.lang.String lastModified)
                            throws java.io.IOException
Get the ETag associated with a file.

Throws:
java.io.IOException

rewriteUrl

protected java.lang.String rewriteUrl(java.lang.String path)
URL rewriter.

Parameters:
path - Path which has to be rewiten


Copyright 2006-2006 media-style. All Rights Reserved.