com.trackstudio.app.webdav
Class WebdavServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.trackstudio.app.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 org.apache.catalina.util.MD5Encoder md5Encoder
          The MD5 helper object for this class.
protected static java.security.MessageDigest md5Helper
          MD5 message digest provider.
protected static org.apache.catalina.util.URLEncoder urlEncoder
          Array containing the safe characters set.
 
Constructor Summary
WebdavServlet()
           
 
Method Summary
static SessionContext authenticate(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          This method checks the user information sent in the Authorization header against the database of users maintained in the users Hashtable.
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 org.apache.catalina.util.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 org.apache.catalina.util.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.

Overrides:
init in class javax.servlet.GenericServlet
Throws:
javax.servlet.ServletException

authenticate

public static SessionContext authenticate(javax.servlet.http.HttpServletRequest req,
                                          javax.servlet.http.HttpServletResponse resp)
                                   throws java.io.IOException
This method checks the user information sent in the Authorization header against the database of users maintained in the users Hashtable.

Parameters:
req - request
Returns:
session id
Throws:
java.io.IOException

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.

Overrides:
service in class javax.servlet.http.HttpServlet
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.

Overrides:
doOptions in class javax.servlet.http.HttpServlet
Parameters:
req - HttpServletRequest
resp - HttpServletResponse class that handles the actual storing
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,
                          GranException
PROPFIND Method.

Parameters:
req - HttpServletRequest
resp - HttpServletResponse param store class that handles the actual storing
Throws:
javax.servlet.ServletException
java.io.IOException
GranException

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

class that handles the actual storing

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,
                     GranException
GET Method

Parameters:
req - HttpServletRequest
resp - HttpServletResponse

class that handles the actual storing

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

doHead

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

Overrides:
doHead in class javax.servlet.http.HttpServlet
Parameters:
req - HttpServletRequest
resp - HttpServletResponse

class that handles the actual storing

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,
                       GranException
MKCOL Method.

Parameters:
req - HttpServletRequest
resp - HttpServletResponse

class that handles the actual storing

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

doDelete

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

Overrides:
doDelete in class javax.servlet.http.HttpServlet
Parameters:
req - HttpServletRequest
resp - HttpServletResponse

class that handles the actual storing

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.

Overrides:
doPut in class javax.servlet.http.HttpServlet
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,
                      GranException
COPY Method.

Parameters:
req - HttpServletRequest
resp - HttpServletResponse

class that handles the actual storing

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

doMove

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

Parameters:
req - HttpServletRequest
resp - HttpServletResponse

class that handles the actual storing

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

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.

param resourceInfo File object

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 © 2002-2009 TrackStudio, Ltd. All Rights Reserved.