org.modeshape.webdav.methods

## Class AbstractMethod

- java.lang.Object
- - org.modeshape.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

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static int` | `BUF_SIZE` size of the io-buffer
    `protected static String` | `CREATION_DATE_FORMAT` Simple date format for the creation date ISO 8601 representation (partial).
    `protected static int` | `DEFAULT_TIMEOUT` Default lock timeout value.
    `protected static int` | `INFINITY` Default depth is infite.
    `protected static String` | `LAST_MODIFIED_DATE_FORMAT` Simple date format for the last modified date.
    `protected static String` | `LOCAL_DATE_FORMAT`
    `protected Logger` | `logger`
    `protected static int` | `MAX_TIMEOUT` Maximum lock timeout.
    `protected static int` | `TEMP_TIMEOUT` Timeout for temporary locks
    `protected static boolean` | `TEMPORARY` Boolean value to temporary lock resources (for method locks)
    `protected static URLEncoder` | `URL_ENCODER` Array containing the safe characters set.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractMethod()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `creationDateFormat(Date date)`
    `protected String` | `getCleanPath(String path)` removes a / at the end of the path string, if present
    `protected int` | `getDepth(HttpServletRequest req)` reads the depth header from the request and returns it as a int
    `protected DocumentBuilder` | `getDocumentBuilder()` Return JAXP document builder instance.
    `protected String` | `getETag(StoredObject so)` Get the ETag associated with a file.
    `static String` | `getLocalDateFormat(Date date, Locale loc)`
    `protected String[]` | `getLockIdFromIfHeader(HttpServletRequest req)`
    `protected String` | `getLockIdFromLockTokenHeader(HttpServletRequest req)`
    `protected String` | `getParentPath(String path)` creates the parent path from the given path by removing the last '/' and everything after that
    `protected String` | `getRelativePath(HttpServletRequest request)` Return the relative path associated with this servlet.
    `protected boolean` | `isUnlocked(ITransaction transaction, 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 String` | `lastModifiedDateFormat(Date date)`
    `protected String` | `rewriteUrl(String path)` URL rewriter.
    `protected void` | `sendReport(HttpServletRequest req, HttpServletResponse resp, Hashtable<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.modeshape.webdav.IMethodExecutor

      `execute`

- - ### Field Detail

    - #### 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:
        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 int BUF_SIZE

      size of the io-buffer

    - #### 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

    - #### logger

          protected Logger logger

  - ### Constructor Detail

    - #### AbstractMethod

          protected AbstractMethod()

  - ### Method Detail

    - #### 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(HttpServletRequest request)

      Return the relative path associated with this servlet.
      Parameters:
        `request` - The servlet request we are processing
      Returns:
        the relative 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 ServletException

      Return JAXP document builder instance.
      Returns:
        the builder
      Throws:
        `ServletException`

    - #### getDepth

          protected int getDepth(HttpServletRequest req)

      reads the depth header from the request and returns it as a int
      Parameters:
        `req` -
      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 so)

      Get the ETag associated with a file.
      Parameters:
        `so` - StoredObject to get resourceLength, lastModified and a hashCode of StoredObject
      Returns:
        the ETag

    - #### getLockIdFromIfHeader

          protected String[] getLockIdFromIfHeader(HttpServletRequest req)

    - #### getLockIdFromLockTokenHeader

          protected String getLockIdFromLockTokenHeader(HttpServletRequest req)

    - #### isUnlocked

          protected boolean isUnlocked(ITransaction transaction,
                           HttpServletRequest req,
                           IResourceLocks resourceLocks,
                           String path)
                                throws IOException,
                                       LockFailedException

      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` -
        `req` - Servlet request
        `resourceLocks` -
        `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:
        `IOException`
        `LockFailedException`

    - #### sendReport

          protected void sendReport(HttpServletRequest req,
                        HttpServletResponse resp,
                        Hashtable<String,Integer> errorList)
                             throws IOException

      Send 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 request
        `resp` - Servlet response
        `errorList` - List of error to be displayed
      Throws:
        `IOException`

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.