|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.opencms.webdav.CmsWebdavServlet
public class CmsWebdavServlet
Servlet which adds support for WebDAV level 2.
Field Summary | |
---|---|
static String |
AUTHORIZATION_BASIC_PREFIX
Basic authorization prefix constant. |
static int |
BUFFER_SIZE
Size of file transfer buffer in bytes. |
protected static DateFormat |
HTTP_DATE_FORMAT
Date format for the last modified date. |
protected static DateFormat |
ISO8601_FORMAT
Date format for the creation date. |
protected int |
m_input
The input buffer size to use when serving resources. |
protected static MessageDigest |
m_md5Helper
MD5 message digest provider. |
protected int |
m_output
The output buffer size to use when serving resources. |
protected static CmsMD5Encoder |
MD5_ENCODER
The MD5 helper object for this class. |
protected static String |
METHOD_COPY
WebDAV method: COPY. |
protected static String |
METHOD_DELETE
HTTP Method: DELETE. |
protected static String |
METHOD_GET
HTTP Method: GET. |
protected static String |
METHOD_HEAD
HTTP Method: HEAD. |
protected static String |
METHOD_LOCK
WebDAV method: LOCK. |
protected static String |
METHOD_MKCOL
WebDAV method: MKCOL. |
protected static String |
METHOD_MOVE
WebDAV method: MOVE. |
protected static String |
METHOD_OPTIONS
HTTP Method: OPTIONS. |
protected static String |
METHOD_POST
HTTP Method: POST. |
protected static String |
METHOD_PROPFIND
WebDAV method: PROPFIND. |
protected static String |
METHOD_PROPPATCH
WebDAV method: PROPPATCH. |
protected static String |
METHOD_PUT
HTTP Method: PUT. |
protected static String |
METHOD_TRACE
HTTP Method: TRACE. |
protected static String |
METHOD_UNLOCK
WebDAV method: UNLOCK. |
protected static String |
MIME_SEPARATION
MIME multipart separation string. |
static String |
SEPARATOR_CREDENTIALS
Credentials separator constant. |
protected static BitSet |
URL_SAFE_CHARS
Chars which are safe for urls. |
Constructor Summary | |
---|---|
CmsWebdavServlet()
|
Method Summary | |
---|---|
static Element |
addElement(Element parent,
String name)
Adds an xml element to the given parent and sets the appropriate namespace and prefix. |
protected void |
copy(I_CmsRepositoryItem item,
InputStream is,
PrintWriter writer)
Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are closed before returning (even in the face of an exception). |
protected void |
copy(I_CmsRepositoryItem item,
InputStream is,
javax.servlet.ServletOutputStream ostream)
Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are closed before returning (even in the face of an exception). |
protected void |
copy(I_CmsRepositoryItem item,
PrintWriter writer,
CmsWebdavRange range)
Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are closed before returning (even in the face of an exception). |
protected void |
copy(I_CmsRepositoryItem item,
PrintWriter writer,
Iterator<CmsWebdavRange> ranges,
String contentType)
Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are closed before returning (even in the face of an exception). |
protected void |
copy(I_CmsRepositoryItem item,
javax.servlet.ServletOutputStream ostream,
CmsWebdavRange range)
Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are closed before returning (even in the face of an exception). |
protected void |
copy(I_CmsRepositoryItem item,
javax.servlet.ServletOutputStream ostream,
Iterator<CmsWebdavRange> ranges,
String contentType)
Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are closed before returning (even in the face of an exception). |
protected IOException |
copyRange(InputStream istream,
javax.servlet.ServletOutputStream ostream)
Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are closed before returning (even in the face of an exception). |
protected IOException |
copyRange(InputStream istream,
javax.servlet.ServletOutputStream ostream,
long start,
long end)
Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are closed before returning (even in the face of an exception). |
protected IOException |
copyRange(Reader reader,
PrintWriter writer)
Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are closed before returning (even in the face of an exception). |
protected IOException |
copyRange(Reader reader,
PrintWriter writer,
long start,
long end)
Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are closed before returning (even in the face of an exception). |
protected void |
doCopy(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Process a COPY WebDAV request for the specified resource. |
protected void |
doDelete(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Process a DELETE WebDAV request for the specified resource. |
protected void |
doGet(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Process a GET request for the specified resource. |
protected void |
doHead(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Process a HEAD request for the specified resource. |
protected void |
doLock(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Process a LOCK WebDAV request for the specified resource. |
protected void |
doMkcol(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Process a MKCOL WebDAV request for the specified resource. |
protected void |
doMove(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Process a MOVE WebDAV request for the specified resource. |
protected void |
doOptions(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Process a OPTIONS WebDAV request for the specified resource. |
protected void |
doPropfind(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Process a PROPFIND WebDAV request for the specified resource. |
protected void |
doProppatch(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
Process a PROPPATCH WebDAV request for the specified resource. |
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)
Process a UNLOCK WebDAV request for the specified resource. |
protected File |
executePartialPut(javax.servlet.http.HttpServletRequest req,
CmsWebdavRange range,
String path)
Handle a partial PUT. |
protected String |
getETag(I_CmsRepositoryItem item)
Get the ETag associated with a file. |
void |
init()
Initialize this servlet. |
protected ArrayList<CmsWebdavRange> |
parseRange(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
I_CmsRepositoryItem item)
Parse the range header. |
protected InputStream |
renderHtml(String contextPath,
String path)
Return an InputStream to an HTML representation of the contents of this directory. |
protected String |
renderSize(long size)
Render the specified file size (in bytes). |
protected String |
rewriteUrl(String path)
URL rewriter. |
protected void |
serveResource(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
boolean content)
Serve the specified resource, optionally including the data content. |
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 |
---|
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 |
---|
public static final String AUTHORIZATION_BASIC_PREFIX
public static final int BUFFER_SIZE
public static final String SEPARATOR_CREDENTIALS
protected static final DateFormat HTTP_DATE_FORMAT
protected static final DateFormat ISO8601_FORMAT
protected static MessageDigest m_md5Helper
protected static final CmsMD5Encoder MD5_ENCODER
protected static final String METHOD_COPY
protected static final String METHOD_DELETE
protected static final String METHOD_GET
protected static final String METHOD_HEAD
protected static final String METHOD_LOCK
protected static final String METHOD_MKCOL
protected static final String METHOD_MOVE
protected static final String METHOD_OPTIONS
protected static final String METHOD_POST
protected static final String METHOD_PROPFIND
protected static final String METHOD_PROPPATCH
protected static final String METHOD_PUT
protected static final String METHOD_TRACE
protected static final String METHOD_UNLOCK
protected static final String MIME_SEPARATION
protected static final BitSet URL_SAFE_CHARS
protected int m_input
protected int m_output
Constructor Detail |
---|
public CmsWebdavServlet()
Method Detail |
---|
public static Element addElement(Element parent, String name)
parent
- the parent node to add the elementname
- the name of the new element
public void init() throws javax.servlet.ServletException
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
- if something goes wrongprotected void copy(I_CmsRepositoryItem item, InputStream is, PrintWriter writer) throws IOException
item
- the RepositoryItemis
- the input stream to copy fromwriter
- the writer to write to
IOException
- if an input/output error occursprotected void copy(I_CmsRepositoryItem item, InputStream is, javax.servlet.ServletOutputStream ostream) throws IOException
item
- the RepositoryItemis
- the input stream to copy fromostream
- the output stream to write to
IOException
- if an input/output error occursprotected void copy(I_CmsRepositoryItem item, PrintWriter writer, CmsWebdavRange range) throws IOException
item
- the RepositoryItemwriter
- the writer to write torange
- the range the client wants to retrieve
IOException
- if an input/output error occursprotected void copy(I_CmsRepositoryItem item, PrintWriter writer, Iterator<CmsWebdavRange> ranges, String contentType) throws IOException
item
- the RepositoryItemwriter
- the writer to write toranges
- iterator of the ranges the client wants to retrievecontentType
- the content type of the resource
IOException
- if an input/output error occursprotected void copy(I_CmsRepositoryItem item, javax.servlet.ServletOutputStream ostream, CmsWebdavRange range) throws IOException
item
- the RepositoryItemostream
- the output stream to write torange
- the range the client wants to retrieve
IOException
- if an input/output error occursprotected void copy(I_CmsRepositoryItem item, javax.servlet.ServletOutputStream ostream, Iterator<CmsWebdavRange> ranges, String contentType) throws IOException
item
- the RepositoryItemostream
- the output stream to write toranges
- iterator of the ranges the client wants to retrievecontentType
- the content type of the resource
IOException
- if an input/output error occursprotected IOException copyRange(InputStream istream, javax.servlet.ServletOutputStream ostream)
istream
- the input stream to read fromostream
- the output stream to write to
protected IOException copyRange(InputStream istream, javax.servlet.ServletOutputStream ostream, long start, long end)
istream
- the input stream to read fromostream
- the output stream to write tostart
- the start of the range which will be copiedend
- the end of the range which will be copied
protected IOException copyRange(Reader reader, PrintWriter writer)
reader
- the reader to read fromwriter
- the writer to write to
protected IOException copyRange(Reader reader, PrintWriter writer, long start, long end)
reader
- the reader to read fromwriter
- the writer to write tostart
- the start of the range which will be copiedend
- the end of the range which will be copied
protected void doCopy(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
req
- the servlet request we are processingresp
- the servlet response we are creatingprotected void doDelete(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws IOException
doDelete
in class javax.servlet.http.HttpServlet
req
- the servlet request we are processingresp
- the servlet response we are creating
IOException
- if an input/output error occursprotected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
doGet
in class javax.servlet.http.HttpServlet
request
- the servlet request we are processingresponse
- the servlet response we are creating
IOException
- if an input/output error occursprotected void doHead(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException
doHead
in class javax.servlet.http.HttpServlet
request
- the servlet request we are processingresponse
- the servlet response we are creating
IOException
- if an input/output error occursprotected void doLock(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws IOException
req
- the servlet request we are processingresp
- the servlet response we are creating
IOException
- if an input/output error occursprotected void doMkcol(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws IOException
req
- the servlet request we are processingresp
- the servlet response we are creating
IOException
- if an input/output error occursprotected void doMove(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
req
- the servlet request we are processingresp
- the servlet response we are creatingprotected void doOptions(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
doOptions
in class javax.servlet.http.HttpServlet
req
- the servlet request we are processingresp
- the servlet response we are creatingprotected void doPropfind(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws IOException
req
- the servlet request we are processingresp
- the servlet response we are creating
IOException
- if an input/output error occursprotected void doProppatch(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
Not implemented yet.
req
- the servlet request we are processingresp
- the servlet response we are creatingprotected void doPut(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws IOException
doPut
in class javax.servlet.http.HttpServlet
req
- the servlet request we are processingresp
- the servlet response we are creating
IOException
- if an input/output error occursprotected void doUnlock(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
req
- the servlet request we are processingresp
- the servlet response we are creatingprotected File executePartialPut(javax.servlet.http.HttpServletRequest req, CmsWebdavRange range, String path) throws IOException
New content specified in request is appended to existing content in oldRevisionContent (if present). This code does not support simultaneous partial updates to the same resource.
req
- the servlet request we are processingrange
- the range of the content in the filepath
- the path where to find the resource
IOException
- if an input/output error occursprotected String getETag(I_CmsRepositoryItem item)
item
- the WebDavItem
protected ArrayList<CmsWebdavRange> parseRange(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, I_CmsRepositoryItem item)
request
- the servlet request we are processingresponse
- the servlet response we are creatingitem
- the WebdavItem with the information
protected InputStream renderHtml(String contextPath, String path) throws IOException
contextPath
- context path to which our internal paths are relativepath
- the path of the resource to render the html for
IOException
- if an input/output error occursprotected String renderSize(long size)
size
- file size (in bytes)
protected String rewriteUrl(String path) throws UnsupportedEncodingException
path
- path which has to be rewritten
UnsupportedEncodingException
- if something goes wrong while encoding the urlprotected void serveResource(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean content) throws IOException
request
- the servlet request we are processingresponse
- the servlet response we are creatingcontent
- should the content be included?
IOException
- if an input/output error occursprotected void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, IOException
service
in class javax.servlet.http.HttpServlet
req
- the servlet request we are processingresp
- the servlet response we are creating
IOException
- if an input/output error occurs
javax.servlet.ServletException
- if a servlet-specified error occurs
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |