Class WebdavManager


  • public class WebdavManager
    extends java.lang.Object
    This class is called by WebdavServlet to handle all webdav protocole. It handle all method declaration, delegate to WebdavFileSystem, then send back a response.
    Since:
    jcms-5.5.0
    Version:
    $Revision: 107554 $
    Author:
    Jean-Philippe Encausse
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String REVISION  
    • Constructor Summary

      Constructors 
      Constructor Description
      WebdavManager()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void doCopy​(WebdavContext ctxt)
      COPY Method If writing is allowed, This method decode HTTP Headers: destinationHeader, path, ovewrite Then call doCopy from WebdavFileSystem
      protected void doDelete​(WebdavContext ctxt)
      DELETE Method.
      protected void doGet​(WebdavContext ctxt, boolean printContent)
      GET Method.
      protected void doHead​(WebdavContext ctxt)
      HEAD Method.
      protected void doLock​(WebdavContext ctxt)
      LOCK Method.
      protected void doMkcol​(WebdavContext ctxt)
      MKCOL Method.
      protected void doMove​(WebdavContext ctxt)
      MOVE Method.
      protected void doOption​(WebdavContext ctxt)
      OPTION Method.
      Update headers with really custom argument: "Pragma" -> "no-cache" "Cache-Control" -> "no-store, no-cache, must-revalidate" "Cache-Control" -> "post-check=0, pre-check=0" "MS-Author-Via" -> "DAV, MS-FP/4.0" "MicrosoftOfficeWebServer" -> "5.0_Pub" "DAV" -> "1, 2, DAVJCMS, access-control"
      protected void doPropfind​(WebdavContext ctxt)
      PROPFIND Method.
      protected java.util.Collection<WebdavProperty> doPropfindByProperty​(com.jalios.jcms.webdav.WebdavManager.PropFindType type, org.jdom.Element propNode)
      If type is FIND_BY_PROPERTY This method will return a list of Properties for the given Property Node
      protected void doProppatch​(WebdavContext ctxt)
      PROPPATCH Method: Not Implemented Create/Delete a resource property on a non locked resource
      WARNING! This methods use in Memory Property management and has no been correctly tested with litmus because JCMS should not use it.
      protected void doPut​(WebdavContext ctxt)
      PUT Method.
      protected void doUnlock​(WebdavContext ctxt)
      UNLOCK Method.
      protected java.lang.String getMethodsAllowed​(WebdavResource res, WebdavContext ctxt)  
      protected org.jdom.Element getPropNode​(WebdavContext ctxt)
      Return the PropertyNode from the XML Document
      protected com.jalios.jcms.webdav.WebdavManager.PropFindType getPropNodeType​(org.jdom.Element propNode)
      This method will parse Property Node Then decode the type of property to display.
      boolean handleWebdavRequest​(WebdavContext ctxt)
      This method handle the HTTP Request then redirect to the right method.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WebdavManager

        public WebdavManager()
    • Method Detail

      • handleWebdavRequest

        public boolean handleWebdavRequest​(WebdavContext ctxt)
                                    throws java.io.IOException
        This method handle the HTTP Request then redirect to the right method.
        Parameters:
        ctxt - The WebdavContext
        Returns:
        booleant true if the method has been found
        Throws:
        java.io.IOException
      • getPropNode

        protected org.jdom.Element getPropNode​(WebdavContext ctxt)
        Return the PropertyNode from the XML Document
        Parameters:
        ctxt - the WegbdavContext
        Returns:
        Node an XML Node
      • getPropNodeType

        protected com.jalios.jcms.webdav.WebdavManager.PropFindType getPropNodeType​(org.jdom.Element propNode)
        This method will parse Property Node Then decode the type of property to display.
        Parameters:
        propNode - the XML Document Node to parse
        Returns:
        int the type of Property
      • doPropfindByProperty

        protected java.util.Collection<WebdavProperty> doPropfindByProperty​(com.jalios.jcms.webdav.WebdavManager.PropFindType type,
                                                                            org.jdom.Element propNode)
        If type is FIND_BY_PROPERTY This method will return a list of Properties for the given Property Node
        Parameters:
        type - the property type
        propNode - the XML Document Node to parse
        Returns:
        Collection a list of properties to work with
      • getMethodsAllowed

        protected java.lang.String getMethodsAllowed​(WebdavResource res,
                                                     WebdavContext ctxt)
        Parameters:
        res - the WebdavResource
        ctxt - the Webdav Context
        Returns:
        String a list of allowed Webdav Methods
      • doPropfind

        protected void doPropfind​(WebdavContext ctxt)
                           throws javax.servlet.ServletException,
                                  java.io.IOException
        PROPFIND Method. If listing is allowed, This method decode HTTP Headers: path, depth, type of propeties Then return an XML of properties of the given type for a given path and subpath at a given depth
        Parameters:
        ctxt - the Webdav Context
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doProppatch

        protected void doProppatch​(WebdavContext ctxt)
                            throws javax.servlet.ServletException,
                                   java.io.IOException
        PROPPATCH Method: Not Implemented Create/Delete a resource property on a non locked resource
        WARNING! This methods use in Memory Property management and has no been correctly tested with litmus because JCMS should not use it. For 1st version of JCMS Webdav Module.
        Parameters:
        ctxt - the Webdav Context
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doMkcol

        protected void doMkcol​(WebdavContext ctxt)
                        throws javax.servlet.ServletException,
                               java.io.IOException
        MKCOL Method. Create new Collection. No ovewrite if one already exists.
        Parameters:
        ctxt - the Webdav Context
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doDelete

        protected void doDelete​(WebdavContext ctxt)
                         throws javax.servlet.ServletException,
                                java.io.IOException
        DELETE Method. Then call doDelete from WebdavFileSystem to recursively resources.
        Parameters:
        ctxt - the Webdav Context
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doCopy

        protected void doCopy​(WebdavContext ctxt)
                       throws javax.servlet.ServletException,
                              java.io.IOException
        COPY Method If writing is allowed, This method decode HTTP Headers: destinationHeader, path, ovewrite Then call doCopy from WebdavFileSystem
        Parameters:
        ctxt - the Webdav Context
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doMove

        protected void doMove​(WebdavContext ctxt)
                       throws javax.servlet.ServletException,
                              java.io.IOException
        MOVE Method. Decode Parameters then call WebdavFileSystem.move()
        Parameters:
        ctxt - the Webdav Context
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doGet

        protected void doGet​(WebdavContext ctxt,
                             boolean printContent)
                      throws javax.servlet.ServletException,
                             java.io.IOException
        GET Method.
        Parameters:
        ctxt - the Webdav Context
        printContent - GET or HEAD ?
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doHead

        protected void doHead​(WebdavContext ctxt)
                       throws javax.servlet.ServletException,
                              java.io.IOException
        HEAD Method.
        Parameters:
        ctxt - the Webdav Context
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doPut

        protected void doPut​(WebdavContext ctxt)
                      throws javax.servlet.ServletException,
                             java.io.IOException
        PUT Method. A PUT that would result in the creation of a resource without an appropriately scoped parent collection MUST fail with a 409(Conflict).
        Parameters:
        ctxt - the Webdav Context
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doLock

        protected void doLock​(WebdavContext ctxt)
                       throws javax.servlet.ServletException,
                              java.io.IOException
        LOCK Method.
        Parameters:
        ctxt - the Webdav Context
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doUnlock

        protected void doUnlock​(WebdavContext ctxt)
                         throws javax.servlet.ServletException,
                                java.io.IOException
        UNLOCK Method.
        Parameters:
        ctxt - the Webdav Context
        Throws:
        javax.servlet.ServletException
        java.io.IOException
      • doOption

        protected void doOption​(WebdavContext ctxt)
                         throws javax.servlet.ServletException,
                                java.io.IOException
        OPTION Method.
        Update headers with really custom argument:
        • "Pragma" -> "no-cache"
        • "Cache-Control" -> "no-store, no-cache, must-revalidate"
        • "Cache-Control" -> "post-check=0, pre-check=0"
        • "MS-Author-Via" -> "DAV, MS-FP/4.0"
        • "MicrosoftOfficeWebServer" -> "5.0_Pub"
        • "DAV" -> "1, 2, DAVJCMS, access-control"
        Parameters:
        ctxt - the Webdav Context
        Throws:
        javax.servlet.ServletException
        java.io.IOException