Package nl.info.webdav.methods
Class AbstractMethod
java.lang.Object
nl.info.webdav.methods.AbstractMethod
- All Implemented Interfaces:
IMethodExecutor
- Direct Known Subclasses:
DeterminableMethod,DoCopy,DoDelete,DoHead,DoLock,DoMkcol,DoMove,DoPropfind,DoProppatch,DoPut
Abstract base class for the implementation of the different WebDAV methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static intsize of the io-bufferprotected static final StringSimple date format for the creation date ISO 8601 representation (partial).protected static final intDefault lock timeout value.protected static final intDefault depth is infite.protected static final StringSimple date format for the last modified date.protected static final StringFormat for local date values.protected static final intMaximum lock timeout.protected static final intTimeout for temporary locksprotected static final booleanBoolean value to temporary lock resources (for method locks)protected static URLEncoderArray containing the safe characters set. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckLocks(ITransaction transaction, jakarta.servlet.http.HttpServletRequest httpServletRequest, 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 StringgetCleanPath(String path) removes a / at the end of the path string, if presentprotected intgetDepth(jakarta.servlet.http.HttpServletRequest httpServletRequest) reads the depth header from the request and returns it as a intprotected DocumentBuilderReturn JAXP document builder instance.protected StringgetETag(StoredObject storedObject) Get the ETag for with a stored object.static StringgetLocalDateFormat(Date date, Locale loc) protected String[]getLockIdFromIfHeader(jakarta.servlet.http.HttpServletRequest req) protected StringgetLockIdFromLockTokenHeader(jakarta.servlet.http.HttpServletRequest req) protected StringgetParentPath(String path) creates the parent path from the given path by removing the last '/' and everything after thatprotected StringgetRelativePath(jakarta.servlet.http.HttpServletRequest request) Return the relative path associated with this servlet.static StringlastModifiedDateFormat(Date date) protected StringrewriteUrl(String path) URL rewriter.protected voidsendReport(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp, Hashtable<String, Integer> errorList) Send a multi-status 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, waitMethods inherited from interface nl.info.webdav.IMethodExecutor
execute
-
Field Details
-
URL_ENCODER
Array containing the safe characters set. -
INFINITY
protected static final int INFINITYDefault depth is infite.- See Also:
-
CREATION_DATE_FORMAT
Simple date format for the creation date ISO 8601 representation (partial).- See Also:
-
LAST_MODIFIED_DATE_FORMAT
Simple date format for the last modified date. (RFC 822 updated by RFC 1123)- See Also:
-
LOCAL_DATE_FORMAT
Format for local date values.- See Also:
-
BUF_SIZE
protected static int BUF_SIZEsize of the io-buffer -
DEFAULT_TIMEOUT
protected static final int DEFAULT_TIMEOUTDefault lock timeout value.- See Also:
-
MAX_TIMEOUT
protected static final int MAX_TIMEOUTMaximum lock timeout.- See Also:
-
TEMPORARY
protected static final boolean TEMPORARYBoolean value to temporary lock resources (for method locks)- See Also:
-
TEMP_TIMEOUT
protected static final int TEMP_TIMEOUTTimeout for temporary locks- See Also:
-
-
Constructor Details
-
AbstractMethod
public AbstractMethod()
-
-
Method Details
-
lastModifiedDateFormat
-
creationDateFormat
-
getLocalDateFormat
-
getRelativePath
Return the relative path associated with this servlet.- Parameters:
request- the servlet request we are processing- Returns:
- the relative servlet path
-
getParentPath
creates the parent path from the given path by removing the last '/' and everything after that- Parameters:
path- the path- Returns:
- parent path
-
getCleanPath
removes a / at the end of the path string, if present- Parameters:
path- the path- Returns:
- the path without trailing /
-
getDocumentBuilder
Return JAXP document builder instance.- Returns:
- the document builder
- Throws:
jakarta.servlet.ServletException- when the builder could not be constructed
-
getDepth
protected int getDepth(jakarta.servlet.http.HttpServletRequest httpServletRequest) reads the depth header from the request and returns it as a int- Parameters:
httpServletRequest- the servlet request- Returns:
- the depth from the depth header
-
rewriteUrl
URL rewriter.- Parameters:
path- path which has to be rewiten- Returns:
- the rewritten path
-
getETag
Get the ETag for with a stored object.- Parameters:
storedObject- the stored object- Returns:
- the ETag as a string
-
getLockIdFromIfHeader
-
getLockIdFromLockTokenHeader
-
checkLocks
protected boolean checkLocks(ITransaction transaction, jakarta.servlet.http.HttpServletRequest httpServletRequest, 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:
transaction- the current WebDAV transactionhttpServletRequest- servlet requestresourceLocks- resource lockspath- 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
-
sendReport
protected void sendReport(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp, Hashtable<String, Integer> errorList) throws IOExceptionSend a multi-status 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 multi-status message.- Parameters:
req- servlet requestresp- servlet responseerrorList- list of error to be displayed- Throws:
IOException- if an error occurs while sending the error report
-