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

public abstract class AbstractMethod extends Object implements IMethodExecutor
Abstract base class for the implementation of the different WebDAV methods.
  • Field Details

    • URL_ENCODER

      protected static URLEncoder URL_ENCODER
      Array containing the safe characters set.
    • INFINITY

      protected static final int INFINITY
      Default depth is infite.
      See Also:
    • CREATION_DATE_FORMAT

      protected static final String CREATION_DATE_FORMAT
      Simple date format for the creation date ISO 8601 representation (partial).
      See Also:
    • 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:
    • LOCAL_DATE_FORMAT

      protected static final String LOCAL_DATE_FORMAT
      Format for local date values.
      See Also:
    • BUF_SIZE

      protected static int BUF_SIZE
      size of the io-buffer
    • DEFAULT_TIMEOUT

      protected static final int DEFAULT_TIMEOUT
      Default lock timeout value.
      See Also:
    • MAX_TIMEOUT

      protected static final int MAX_TIMEOUT
      Maximum lock timeout.
      See Also:
    • TEMPORARY

      protected static final boolean TEMPORARY
      Boolean value to temporary lock resources (for method locks)
      See Also:
    • TEMP_TIMEOUT

      protected static final int TEMP_TIMEOUT
      Timeout for temporary locks
      See Also:
  • Constructor Details

    • AbstractMethod

      public AbstractMethod()
  • Method Details

    • lastModifiedDateFormat

      public static String lastModifiedDateFormat(Date date)
    • creationDateFormat

      public static String creationDateFormat(Date date)
    • getLocalDateFormat

      public static String getLocalDateFormat(Date date, Locale loc)
    • getRelativePath

      protected String getRelativePath(jakarta.servlet.http.HttpServletRequest request)
      Return the relative path associated with this servlet.
      Parameters:
      request - the servlet request we are processing
      Returns:
      the relative servlet path
    • getParentPath

      protected 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 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 DocumentBuilder getDocumentBuilder() throws jakarta.servlet.ServletException
      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

      protected String rewriteUrl(String path)
      URL rewriter.
      Parameters:
      path - path which has to be rewiten
      Returns:
      the rewritten path
    • getETag

      protected String getETag(StoredObject storedObject)
      Get the ETag for with a stored object.
      Parameters:
      storedObject - the stored object
      Returns:
      the ETag as a string
    • getLockIdFromIfHeader

      protected String[] getLockIdFromIfHeader(jakarta.servlet.http.HttpServletRequest req)
    • getLockIdFromLockTokenHeader

      protected String getLockIdFromLockTokenHeader(jakarta.servlet.http.HttpServletRequest req)
    • 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 transaction
      httpServletRequest - servlet request
      resourceLocks - resource locks
      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
    • sendReport

      protected void sendReport(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp, Hashtable<String,Integer> errorList) throws IOException
      Send 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 request
      resp - servlet response
      errorList - list of error to be displayed
      Throws:
      IOException - if an error occurs while sending the error report