Class WebDavServiceImpl

  • All Implemented Interfaces:
    WebDavService, org.exoplatform.services.rest.resource.ResourceContainer

    public class WebDavServiceImpl
    extends Object
    implements WebDavService, org.exoplatform.services.rest.resource.ResourceContainer
    Created by The eXo Platform SAS. WebDavServiceImpl is the WebDav connector on top of eXo JCR. It allows to execute CRUD operations on the JCR thanks to the Webdav protocol.
    Author:
    Gennady Azarenkov
    • Field Detail

      • webDavServiceInitParams

        protected WebDavServiceInitParams webDavServiceInitParams
        Encapsulates WebDAV service initial parameters.
    • Constructor Detail

      • WebDavServiceImpl

        public WebDavServiceImpl​(org.exoplatform.container.xml.InitParams params,
                                 org.exoplatform.services.jcr.RepositoryService repositoryService,
                                 org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviderService)
                          throws Exception
        Constructor.
        Parameters:
        params - Initialization parameters
        repositoryService - repository service
        sessionProviderService - session provider service
        Throws:
        Exception - Exception
      • WebDavServiceImpl

        protected WebDavServiceImpl​(Map<String,​String> params,
                                    org.exoplatform.services.jcr.RepositoryService repositoryService,
                                    org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviderService)
                             throws Exception
        Constructor.
        Parameters:
        params - Initialization params
        repositoryService - repository service
        sessionProviderService - session provider service
        Throws:
        Exception
      • WebDavServiceImpl

        protected WebDavServiceImpl​(org.exoplatform.services.jcr.RepositoryService repositoryService,
                                    org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviderService)
        Constructor.
        Parameters:
        repositoryService - repository service
        sessionProviderService - session provider service
    • Method Detail

      • checkin

        public javax.ws.rs.core.Response checkin​(String repoName,
                                                 String repoPath,
                                                 @HeaderParam("lock-token")
                                                 String lockTokenHeader,
                                                 @HeaderParam("If")
                                                 String ifHeader)
        Specified by:
        checkin in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If- HTTP Header
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • checkout

        public javax.ws.rs.core.Response checkout​(String repoName,
                                                  String repoPath,
                                                  @HeaderParam("lock-token")
                                                  String lockTokenHeader,
                                                  @HeaderParam("If")
                                                  String ifHeader)
        Specified by:
        checkout in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If- HTTP Header
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • copy

        public javax.ws.rs.core.Response copy​(String repoName,
                                              String repoPath,
                                              @HeaderParam("Destination")
                                              String destinationHeader,
                                              @HeaderParam("lock-token")
                                              String lockTokenHeader,
                                              @HeaderParam("If")
                                              String ifHeader,
                                              @HeaderParam("depth")
                                              String depthHeader,
                                              @HeaderParam("Overwrite")
                                              String overwriteHeader,
                                              @Context
                                              javax.ws.rs.core.UriInfo uriInfo,
                                              org.exoplatform.common.util.HierarchicalProperty body)
        Specified by:
        copy in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        destinationHeader - Destination HTTP Header
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If- HTTP Header
        depthHeader - Depth HTTP header
        overwriteHeader - Overwrite HTTP header
        uriInfo - base URI info
        body - Request body
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • delete

        public javax.ws.rs.core.Response delete​(String repoName,
                                                String repoPath,
                                                @HeaderParam("lock-token")
                                                String lockTokenHeader,
                                                @HeaderParam("If")
                                                String ifHeader)
        Specified by:
        delete in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If HTTP Header
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • get

        public javax.ws.rs.core.Response get​(String repoName,
                                             String repoPath,
                                             @HeaderParam("Range")
                                             String rangeHeader,
                                             @HeaderParam("If-Modified-Since")
                                             String ifModifiedSince,
                                             @HeaderParam("If-None-Match")
                                             String ifNoneMatch,
                                             String version,
                                             @Context
                                             javax.ws.rs.core.UriInfo uriInfo)
        Specified by:
        get in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        rangeHeader - Range HTTP header
        version - version name
        ifModifiedSince - if-modified-since header
        ifNoneMatch - if-none-match header
        uriInfo - base URI info
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • lock

        public javax.ws.rs.core.Response lock​(String repoName,
                                              String repoPath,
                                              @HeaderParam("lock-token")
                                              String lockTokenHeader,
                                              @HeaderParam("If")
                                              String ifHeader,
                                              @HeaderParam("depth")
                                              String depthHeader,
                                              org.exoplatform.common.util.HierarchicalProperty body)
        Specified by:
        lock in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If- HTTP Header
        depthHeader - Depth HTTP header
        body - Request body
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • unlock

        public javax.ws.rs.core.Response unlock​(String repoName,
                                                String repoPath,
                                                @HeaderParam("lock-token")
                                                String lockTokenHeader,
                                                @HeaderParam("If")
                                                String ifHeader)
        Specified by:
        unlock in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If- HTTP Header
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • mkcol

        public javax.ws.rs.core.Response mkcol​(String repoName,
                                               String repoPath,
                                               @HeaderParam("lock-token")
                                               String lockTokenHeader,
                                               @HeaderParam("If")
                                               String ifHeader,
                                               @HeaderParam("Folder-NodeType")
                                               String folderNodeTypeHeader,
                                               @HeaderParam("Content-MixinTypes")
                                               String mixinTypesHeader,
                                               @Context
                                               javax.ws.rs.core.UriInfo uriInfo)
        Specified by:
        mkcol in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If- HTTP Header
        folderNodeTypeHeader - JCR Node-Type header
        mixinTypesHeader - JCR Mixin-Types header
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • move

        public javax.ws.rs.core.Response move​(String repoName,
                                              String repoPath,
                                              @HeaderParam("Destination")
                                              String destinationHeader,
                                              @HeaderParam("lock-token")
                                              String lockTokenHeader,
                                              @HeaderParam("If")
                                              String ifHeader,
                                              @HeaderParam("depth")
                                              String depthHeader,
                                              @HeaderParam("Overwrite")
                                              String overwriteHeader,
                                              @Context
                                              javax.ws.rs.core.UriInfo uriInfo,
                                              org.exoplatform.common.util.HierarchicalProperty body)
        Specified by:
        move in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        destinationHeader - Destination HTTP header
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If- HTTP Header
        depthHeader - Depth HTTP header
        overwriteHeader - Overwrite HTTP header
        uriInfo - base URI info
        body - Request body
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • options

        public javax.ws.rs.core.Response options​(String path)
        Specified by:
        options in interface WebDavService
        Parameters:
        path -
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • order

        public javax.ws.rs.core.Response order​(String repoName,
                                               String repoPath,
                                               @HeaderParam("lock-token")
                                               String lockTokenHeader,
                                               @HeaderParam("If")
                                               String ifHeader,
                                               @Context
                                               javax.ws.rs.core.UriInfo uriInfo,
                                               org.exoplatform.common.util.HierarchicalProperty body)
        Specified by:
        order in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If- HTTP Header
        uriInfo - base URI info
        body - Request body
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • propfind

        public javax.ws.rs.core.Response propfind​(String repoName,
                                                  String repoPath,
                                                  @HeaderParam("depth")
                                                  String depthHeader,
                                                  @Context
                                                  javax.ws.rs.core.UriInfo uriInfo,
                                                  org.exoplatform.common.util.HierarchicalProperty body)
        Specified by:
        propfind in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        depthHeader - Depth HTTP header
        uriInfo - base URI info
        body - Request body
        Returns:
        the instance of javax.ws.rs.core.Response HTTP response
        eXo level API
        Platform
      • proppatch

        public javax.ws.rs.core.Response proppatch​(String repoName,
                                                   String repoPath,
                                                   @HeaderParam("lock-token")
                                                   String lockTokenHeader,
                                                   @HeaderParam("If")
                                                   String ifHeader,
                                                   @Context
                                                   javax.ws.rs.core.UriInfo uriInfo,
                                                   org.exoplatform.common.util.HierarchicalProperty body)
        Specified by:
        proppatch in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If- HTTP Header
        uriInfo - base URI info
        body - Request body
        Returns:
        the instance of javax.ws.rs.core.Response HTTP response
        eXo level API
        Platform
      • put

        public javax.ws.rs.core.Response put​(String repoName,
                                             String repoPath,
                                             @HeaderParam("lock-token")
                                             String lockTokenHeader,
                                             @HeaderParam("If")
                                             String ifHeader,
                                             @HeaderParam("File-NodeType")
                                             String fileNodeTypeHeader,
                                             @HeaderParam("Content-NodeType")
                                             String contentNodeTypeHeader,
                                             @HeaderParam("Content-MixinTypes")
                                             String mixinTypes,
                                             @HeaderParam("Content-Type")
                                             javax.ws.rs.core.MediaType mediaType,
                                             @HeaderParam("User-Agent")
                                             String userAgent,
                                             InputStream inputStream,
                                             @Context
                                             javax.ws.rs.core.UriInfo uriInfo)
        Specified by:
        put in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If HTTP Header
        fileNodeTypeHeader - JCR NodeType header
        contentNodeTypeHeader - JCR Content-NodeType header
        mixinTypes - JCR Mixin types header
        mediaType - Content-Type HTTP header
        userAgent - User-Agent HTTP header
        inputStream - stream that contain incoming data
        uriInfo - URI info
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • report

        public javax.ws.rs.core.Response report​(String repoName,
                                                String repoPath,
                                                @HeaderParam("depth")
                                                String depthHeader,
                                                @Context
                                                javax.ws.rs.core.UriInfo uriInfo,
                                                org.exoplatform.common.util.HierarchicalProperty body)
        Specified by:
        report in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        depthHeader - Depth HTTP header
        uriInfo - base URI info
        body - Request body
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • search

        public javax.ws.rs.core.Response search​(String repoName,
                                                String repoPath,
                                                @Context
                                                javax.ws.rs.core.UriInfo uriInfo,
                                                org.exoplatform.common.util.HierarchicalProperty body)
        Specified by:
        search in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        uriInfo - base URI info
        body - Request body
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • uncheckout

        public javax.ws.rs.core.Response uncheckout​(String repoName,
                                                    String repoPath,
                                                    @HeaderParam("lock-token")
                                                    String lockTokenHeader,
                                                    @HeaderParam("If")
                                                    String ifHeader)
        Specified by:
        uncheckout in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If- HTTP Header
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • versionControl

        public javax.ws.rs.core.Response versionControl​(String repoName,
                                                        String repoPath,
                                                        @HeaderParam("lock-token")
                                                        String lockTokenHeader,
                                                        @HeaderParam("If")
                                                        String ifHeader)
        Specified by:
        versionControl in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If- HTTP Header
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Platform
      • acl

        public javax.ws.rs.core.Response acl​(String repoName,
                                             String repoPath,
                                             @HeaderParam("lock-token")
                                             String lockTokenHeader,
                                             @HeaderParam("If")
                                             String ifHeader,
                                             org.exoplatform.common.util.HierarchicalProperty body)
        WebDAV ACL method according to protocol extension - Access Control Protocol: RFC3744 More details here: Web Distributed Authoring and Versioning (WebDAV) Access Control Protocol
        Specified by:
        acl in interface WebDavService
        Parameters:
        repoName - repository name
        repoPath - path in repository
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If- HTTP Header
        body - Request body
        Returns:
        the instance of javax.ws.rs.core.Response
        eXo level API
        Provisional
      • session

        protected javax.jcr.Session session​(String repoName,
                                            String wsName,
                                            List<String> lockTokens)
                                     throws Exception,
                                            javax.jcr.NoSuchWorkspaceException
        Gives access to the current session.
        Parameters:
        repoName - repository name
        wsName - workspace name
        lockTokens - Lock tokens
        Returns:
        current session
        Throws:
        Exception - Exception
        javax.jcr.NoSuchWorkspaceException
      • getRepositoryName

        protected String getRepositoryName​(String repoName)
                                    throws javax.jcr.RepositoryException
        Gives the name of the repository to access.
        Parameters:
        repoName - the name of the expected repository.
        Returns:
        the name of the repository to access.
        Throws:
        javax.jcr.RepositoryException
      • workspaceName

        protected String workspaceName​(String repoPath)
        Extracts workspace name from repository path.
        Parameters:
        repoPath - repository path
        Returns:
        workspace name
      • normalizePath

        protected String normalizePath​(String repoPath)
        Normalizes path.
        Parameters:
        repoPath - repository path
        Returns:
        normalized path.
      • path

        protected String path​(String repoPath)
        Extracts path from repository path.
        Parameters:
        repoPath - repository path
        Returns:
        path
      • path

        protected String path​(String repoPath,
                              boolean withIndex)
        Extracts path from repository path.
        Parameters:
        repoPath - repository path
        withIndex - indicates whether the index must be removed or not
        Returns:
        path
      • lockTokens

        protected List<String> lockTokens​(String lockTokenHeader,
                                          String ifHeader)
        Creates the list of Lock tokens from Lock-Token and If headers.
        Parameters:
        lockTokenHeader - Lock-Token HTTP header
        ifHeader - If HTTP header
        Returns:
        the list of lock tokens