public class CmsWebdavServlet
extends javax.servlet.http.HttpServlet
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
AUTHORIZATION_BASIC_PREFIX
Basic authorization prefix constant.
|
static int |
BUFFER_SIZE
Size of file transfer buffer in bytes.
|
protected static java.text.DateFormat |
HTTP_DATE_FORMAT
Date format for the last modified date.
|
protected static java.text.DateFormat |
ISO8601_FORMAT
Date format for the creation date.
|
protected int |
m_input
The input buffer size to use when serving resources.
|
protected static java.security.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 java.lang.String |
METHOD_COPY
WebDAV method: COPY.
|
protected static java.lang.String |
METHOD_DELETE
HTTP Method: DELETE.
|
protected static java.lang.String |
METHOD_GET
HTTP Method: GET.
|
protected static java.lang.String |
METHOD_HEAD
HTTP Method: HEAD.
|
protected static java.lang.String |
METHOD_LOCK
WebDAV method: LOCK.
|
protected static java.lang.String |
METHOD_MKCOL
WebDAV method: MKCOL.
|
protected static java.lang.String |
METHOD_MOVE
WebDAV method: MOVE.
|
protected static java.lang.String |
METHOD_OPTIONS
HTTP Method: OPTIONS.
|
protected static java.lang.String |
METHOD_POST
HTTP Method: POST.
|
protected static java.lang.String |
METHOD_PROPFIND
WebDAV method: PROPFIND.
|
protected static java.lang.String |
METHOD_PROPPATCH
WebDAV method: PROPPATCH.
|
protected static java.lang.String |
METHOD_PUT
HTTP Method: PUT.
|
protected static java.lang.String |
METHOD_TRACE
HTTP Method: TRACE.
|
protected static java.lang.String |
METHOD_UNLOCK
WebDAV method: UNLOCK.
|
protected static java.lang.String |
MIME_SEPARATION
MIME multipart separation string.
|
static java.lang.String |
SEPARATOR_CREDENTIALS
Credentials separator constant.
|
protected static java.util.BitSet |
URL_SAFE_CHARS
Chars which are safe for urls.
|
构造器和说明 |
---|
CmsWebdavServlet() |
限定符和类型 | 方法和说明 |
---|---|
static org.dom4j.Element |
addElement(org.dom4j.Element parent,
java.lang.String name)
Adds an xml element to the given parent and sets the appropriate namespace and
prefix.
|
protected void |
copy(I_CmsRepositoryItem item,
java.io.InputStream is,
java.io.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,
java.io.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,
java.io.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,
java.io.PrintWriter writer,
java.util.Iterator<CmsWebdavRange> ranges,
java.lang.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,
java.util.Iterator<CmsWebdavRange> ranges,
java.lang.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 java.io.IOException |
copyRange(java.io.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 java.io.IOException |
copyRange(java.io.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 java.io.IOException |
copyRange(java.io.Reader reader,
java.io.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 java.io.IOException |
copyRange(java.io.Reader reader,
java.io.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 java.io.File |
executePartialPut(javax.servlet.http.HttpServletRequest req,
CmsWebdavRange range,
java.lang.String path)
Handle a partial PUT.
|
protected java.lang.String |
getETag(I_CmsRepositoryItem item)
Get the ETag associated with a file.
|
void |
init()
Initialize this servlet.
|
protected java.util.ArrayList<CmsWebdavRange> |
parseRange(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
I_CmsRepositoryItem item)
Parse the range header.
|
protected java.io.InputStream |
renderHtml(java.lang.String contextPath,
java.lang.String path)
Return an InputStream to an HTML representation of the contents
of this directory.
|
protected java.lang.String |
renderSize(long size)
Render the specified file size (in bytes).
|
protected java.lang.String |
rewriteUrl(java.lang.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.
|
public static final java.lang.String AUTHORIZATION_BASIC_PREFIX
public static final int BUFFER_SIZE
public static final java.lang.String SEPARATOR_CREDENTIALS
protected static final java.text.DateFormat HTTP_DATE_FORMAT
protected static final java.text.DateFormat ISO8601_FORMAT
protected static java.security.MessageDigest m_md5Helper
protected static final CmsMD5Encoder MD5_ENCODER
protected static final java.lang.String METHOD_COPY
protected static final java.lang.String METHOD_DELETE
protected static final java.lang.String METHOD_GET
protected static final java.lang.String METHOD_HEAD
protected static final java.lang.String METHOD_LOCK
protected static final java.lang.String METHOD_MKCOL
protected static final java.lang.String METHOD_MOVE
protected static final java.lang.String METHOD_OPTIONS
protected static final java.lang.String METHOD_POST
protected static final java.lang.String METHOD_PROPFIND
protected static final java.lang.String METHOD_PROPPATCH
protected static final java.lang.String METHOD_PUT
protected static final java.lang.String METHOD_TRACE
protected static final java.lang.String METHOD_UNLOCK
protected static final java.lang.String MIME_SEPARATION
protected static final java.util.BitSet URL_SAFE_CHARS
protected int m_input
protected int m_output
public static org.dom4j.Element addElement(org.dom4j.Element parent, java.lang.String name)
parent
- the parent node to add the elementname
- the name of the new elementpublic void init() throws javax.servlet.ServletException
init
在类中 javax.servlet.GenericServlet
javax.servlet.ServletException
- if something goes wrongprotected void copy(I_CmsRepositoryItem item, java.io.InputStream is, java.io.PrintWriter writer) throws java.io.IOException
item
- the RepositoryItemis
- the input stream to copy fromwriter
- the writer to write tojava.io.IOException
- if an input/output error occursprotected void copy(I_CmsRepositoryItem item, java.io.InputStream is, javax.servlet.ServletOutputStream ostream) throws java.io.IOException
item
- the RepositoryItemis
- the input stream to copy fromostream
- the output stream to write tojava.io.IOException
- if an input/output error occursprotected void copy(I_CmsRepositoryItem item, java.io.PrintWriter writer, CmsWebdavRange range) throws java.io.IOException
item
- the RepositoryItemwriter
- the writer to write torange
- the range the client wants to retrievejava.io.IOException
- if an input/output error occursprotected void copy(I_CmsRepositoryItem item, java.io.PrintWriter writer, java.util.Iterator<CmsWebdavRange> ranges, java.lang.String contentType) throws java.io.IOException
item
- the RepositoryItemwriter
- the writer to write toranges
- iterator of the ranges the client wants to retrievecontentType
- the content type of the resourcejava.io.IOException
- if an input/output error occursprotected void copy(I_CmsRepositoryItem item, javax.servlet.ServletOutputStream ostream, CmsWebdavRange range) throws java.io.IOException
item
- the RepositoryItemostream
- the output stream to write torange
- the range the client wants to retrievejava.io.IOException
- if an input/output error occursprotected void copy(I_CmsRepositoryItem item, javax.servlet.ServletOutputStream ostream, java.util.Iterator<CmsWebdavRange> ranges, java.lang.String contentType) throws java.io.IOException
item
- the RepositoryItemostream
- the output stream to write toranges
- iterator of the ranges the client wants to retrievecontentType
- the content type of the resourcejava.io.IOException
- if an input/output error occursprotected java.io.IOException copyRange(java.io.InputStream istream, javax.servlet.ServletOutputStream ostream)
istream
- the input stream to read fromostream
- the output stream to write toprotected java.io.IOException copyRange(java.io.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 copiedprotected java.io.IOException copyRange(java.io.Reader reader, java.io.PrintWriter writer)
reader
- the reader to read fromwriter
- the writer to write toprotected java.io.IOException copyRange(java.io.Reader reader, java.io.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 copiedprotected 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 java.io.IOException
doDelete
在类中 javax.servlet.http.HttpServlet
req
- the servlet request we are processingresp
- the servlet response we are creatingjava.io.IOException
- if an input/output error occursprotected void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
doGet
在类中 javax.servlet.http.HttpServlet
request
- the servlet request we are processingresponse
- the servlet response we are creatingjava.io.IOException
- if an input/output error occursprotected void doHead(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
doHead
在类中 javax.servlet.http.HttpServlet
request
- the servlet request we are processingresponse
- the servlet response we are creatingjava.io.IOException
- if an input/output error occursprotected void doLock(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws java.io.IOException
req
- the servlet request we are processingresp
- the servlet response we are creatingjava.io.IOException
- if an input/output error occursprotected void doMkcol(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws java.io.IOException
req
- the servlet request we are processingresp
- the servlet response we are creatingjava.io.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
在类中 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 java.io.IOException
req
- the servlet request we are processingresp
- the servlet response we are creatingjava.io.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 java.io.IOException
doPut
在类中 javax.servlet.http.HttpServlet
req
- the servlet request we are processingresp
- the servlet response we are creatingjava.io.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 java.io.File executePartialPut(javax.servlet.http.HttpServletRequest req, CmsWebdavRange range, java.lang.String path) throws java.io.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 resourcejava.io.IOException
- if an input/output error occursprotected java.lang.String getETag(I_CmsRepositoryItem item)
item
- the WebDavItemprotected java.util.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 informationprotected java.io.InputStream renderHtml(java.lang.String contextPath, java.lang.String path) throws java.io.IOException
contextPath
- context path to which our internal paths are relativepath
- the path of the resource to render the html forjava.io.IOException
- if an input/output error occursprotected java.lang.String renderSize(long size)
size
- file size (in bytes)protected java.lang.String rewriteUrl(java.lang.String path) throws java.io.UnsupportedEncodingException
path
- path which has to be rewrittenjava.io.UnsupportedEncodingException
- if something goes wrong while encoding the urlprotected void serveResource(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, boolean content) throws java.io.IOException
request
- the servlet request we are processingresponse
- the servlet response we are creatingcontent
- should the content be included?java.io.IOException
- if an input/output error occursprotected void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp) throws javax.servlet.ServletException, java.io.IOException
service
在类中 javax.servlet.http.HttpServlet
req
- the servlet request we are processingresp
- the servlet response we are creatingjava.io.IOException
- if an input/output error occursjavax.servlet.ServletException
- if a servlet-specified error occurs