Package org.drjekyll.webdav.methods
Class Method
- java.lang.Object
-
- org.drjekyll.webdav.methods.Method
-
- All Implemented Interfaces:
MethodExecutor
- Direct Known Subclasses:
DeterminableMethod,DoCopy,DoDelete,DoHead,DoLock,DoMkcol,DoMove,DoPropfind,DoProppatch,DoPut
public abstract class Method extends Object implements MethodExecutor
-
-
Field Summary
Fields Modifier and Type Field Description protected static intBUF_SIZEsize of the io-bufferprotected static StringCREATION_DATE_FORMATSimple date format for the creation date ISO 8601 representation (partial).protected static intDEFAULT_TIMEOUTDefault lock timeout value.protected static intINFINITYDefault depth is infite.protected static StringLAST_MODIFIED_DATE_FORMATSimple date format for the last modified date.protected static StringLOCAL_DATE_FORMATprotected static intMAX_TIMEOUTMaximum lock timeout.protected static intTEMP_TIMEOUTTimeout for temporary locksprotected static booleanTEMPORARYBoolean value to temporary lock resources (for method locks)protected static URLEncoderURL_ENCODERArray containing the safe characters set.
-
Constructor Summary
Constructors Constructor Description Method()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static booleancheckLocks(Transaction transaction, javax.servlet.http.HttpServletRequest req, IResourceLocks resourceLocks, String path)Checks if locks on resources at the given path exists and if so checks the If-Header to make sure the If-Header corresponds to the locked resource.static StringcreationDateFormat(Date date)protected static StringgetCleanPath(String path)removes a / at the end of the path string, if presentprotected static intgetDepth(javax.servlet.http.HttpServletRequest req)reads the depth header from the request and returns it as a intprotected static DocumentBuildergetDocumentBuilder()Return JAXP document builder instance.protected static StringgetETag(StoredObject so)Get the ETag associated with a file.static StringgetLocalDateFormat(Date date, Locale loc)protected static String[]getLockIdFromIfHeader(javax.servlet.http.HttpServletRequest req)protected static StringgetLockIdFromLockTokenHeader(javax.servlet.http.HttpServletRequest req)protected static StringgetParentPath(String path)creates the parent path from the given path by removing the last '/' and everything after thatprotected static StringgetRelativePath(javax.servlet.http.HttpServletRequest request)Return the relative path associated with this servlet.static StringlastModifiedDateFormat(Date date)protected static StringrewriteUrl(String path)URL rewriter.protected static voidsendReport(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, Map<String,Integer> errorList)Send a multistatus element containing a complete error report to the client.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.drjekyll.webdav.MethodExecutor
execute
-
-
-
-
Field Detail
-
URL_ENCODER
protected static final URLEncoder URL_ENCODER
Array containing the safe characters set.
-
INFINITY
protected static final int INFINITY
Default depth is infite.- See Also:
- Constant Field Values
-
CREATION_DATE_FORMAT
protected static final String CREATION_DATE_FORMAT
Simple date format for the creation date ISO 8601 representation (partial).- See Also:
- Constant Field Values
-
LAST_MODIFIED_DATE_FORMAT
protected static final String LAST_MODIFIED_DATE_FORMAT
Simple date format for the last modified date. (RFC 822 updated by RFC 1123)- See Also:
- Constant Field Values
-
LOCAL_DATE_FORMAT
protected static final String LOCAL_DATE_FORMAT
- See Also:
- Constant Field Values
-
BUF_SIZE
protected static final int BUF_SIZE
size of the io-buffer- See Also:
- Constant Field Values
-
DEFAULT_TIMEOUT
protected static final int DEFAULT_TIMEOUT
Default lock timeout value.- See Also:
- Constant Field Values
-
MAX_TIMEOUT
protected static final int MAX_TIMEOUT
Maximum lock timeout.- See Also:
- Constant Field Values
-
TEMPORARY
protected static final boolean TEMPORARY
Boolean value to temporary lock resources (for method locks)- See Also:
- Constant Field Values
-
TEMP_TIMEOUT
protected static final int TEMP_TIMEOUT
Timeout for temporary locks- See Also:
- Constant Field Values
-
-
Method Detail
-
getRelativePath
protected static String getRelativePath(javax.servlet.http.HttpServletRequest request)
Return the relative path associated with this servlet.- Parameters:
request- The servlet request we are processing
-
getParentPath
@Nullable protected static String getParentPath(String path)
creates the parent path from the given path by removing the last '/' and everything after that- Parameters:
path- the path- Returns:
- parent path
-
getCleanPath
protected static String getCleanPath(String path)
removes a / at the end of the path string, if present- Parameters:
path- the path- Returns:
- the path without trailing /
-
getDocumentBuilder
protected static DocumentBuilder getDocumentBuilder() throws javax.servlet.ServletException
Return JAXP document builder instance.- Throws:
javax.servlet.ServletException
-
getDepth
protected static int getDepth(javax.servlet.http.HttpServletRequest req)
reads the depth header from the request and returns it as a int- Parameters:
req- the request- Returns:
- the depth from the depth header
-
rewriteUrl
protected static String rewriteUrl(String path)
URL rewriter.- Parameters:
path- Path which has to be rewiten- Returns:
- the rewritten path
-
getETag
protected static String getETag(StoredObject so)
Get the ETag associated with a file.- Parameters:
so- StoredObject to get resourceLength, lastModified and a hashCode of StoredObject- Returns:
- the ETag
-
getLockIdFromLockTokenHeader
@Nullable protected static String getLockIdFromLockTokenHeader(javax.servlet.http.HttpServletRequest req)
-
checkLocks
protected static boolean checkLocks(Transaction transaction, javax.servlet.http.HttpServletRequest req, IResourceLocks resourceLocks, String path)
Checks if locks on resources at the given path exists and if so checks the If-Header to make sure the If-Header corresponds to the locked resource. Returning true if no lock exists or the If-Header is corresponding to the locked resource- Parameters:
req- Servlet requestresourceLocks-path- path to the resource- Returns:
- true if no lock on a resource with the given path exists or if the If-Header corresponds to the locked resource
- Throws:
LockFailedException
-
getLockIdFromIfHeader
@Nullable protected static String[] getLockIdFromIfHeader(javax.servlet.http.HttpServletRequest req)
-
sendReport
protected static void sendReport(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, Map<String,Integer> errorList) throws IOExceptionSend a multistatus element containing a complete error report to the client. If the errorList contains only one error, send the error directly without wrapping it in a multistatus message.- Parameters:
req- Servlet requestresp- Servlet responseerrorList- List of error to be displayed- Throws:
IOException
-
-