Class FilesEndpoint

    • Field Detail

      • request

        @Context
        protected javax.servlet.http.HttpServletRequest request
      • response

        @Context
        protected javax.servlet.http.HttpServletResponse response
      • httpHeaders

        @Context
        protected javax.ws.rs.core.HttpHeaders httpHeaders
      • blob

        protected Blob blob
      • xpath

        protected String xpath
      • fileId

        protected String fileId
      • baseURL

        protected String baseURL
      • wopiBaseURL

        protected String wopiBaseURL
    • Constructor Detail

      • FilesEndpoint

        public FilesEndpoint()
    • Method Detail

      • checkFileInfo

        public javax.ws.rs.core.Response checkFileInfo()
        Implements the CheckFileInfo operation.

        See CheckFileInfo.

      • getFile

        public Object getFile​(@HeaderParam("X-WOPI-MaxExpectedSize")
                              String maxExpectedSizeHeader)
        Implements the GetFile operation.

        See GetFile.

      • doPost

        public Object doPost​(@HeaderParam("X-WOPI-Override")
                             Operation operation)
      • lockOrUnlockAndRelock

        protected Object lockOrUnlockAndRelock()
        Implements the Lock and UnlockAndRelock operations.

        See Lock and UnlockAndRelock.

      • buildItemVersionResponse

        protected javax.ws.rs.core.Response buildItemVersionResponse​(String operation,
                                                                     Blob blob)
      • getCurrentLock

        protected String getCurrentLock​(String operation)
        Returns the WOPI lock if not null and throws a ConflictException otherwise.

        Must be called to check that a locked document is not locked by Nuxeo.

      • buildConflictResponse

        protected javax.ws.rs.core.Response buildConflictResponse​(String operation,
                                                                  String lock)
        Builds a conflict response with the given WOPI lock as a header.

        Must be called in case of "lock mismatch", for instance when a document is locked by another WOPI client.

      • getLock

        protected Object getLock()
        Implements the GetLock operation.

        See GetLock.

      • unlockOrRefresh

        protected Object unlockOrRefresh​(String operation,
                                         String lock,
                                         boolean unlock)
      • putRelativeFile

        public Object putRelativeFile()
        Implements the PutRelativeFile operation.

        New file creation is not supported, only the binary document conversion is supported.

        See PutRelativeFile.

      • createVersionFromRequestBody

        protected DocumentModel createVersionFromRequestBody​(String filename)
      • renameFile

        public Object renameFile()
        Implements the RenameFile operation.

        See RenameFile.

      • renameBlob

        protected javax.ws.rs.core.Response renameBlob​(String requestedName)
        Renames the blob with the requestedName.
        Returns:
        the expected JSON response for the RenameFile operation.
      • getShareUrl

        public Object getShareUrl()
        Implements the GetShareUrl operation.

        See GetShareUrl.

      • doPostContents

        public Object doPostContents​(@HeaderParam("X-WOPI-Override")
                                     Operation operation)
      • putFile

        public Object putFile()
        Implements the PutFile operation.

        See PutFile.

      • updateBlob

        protected javax.ws.rs.core.Response updateBlob()
        Updates the document's blob from a new one.
        Returns:
        the expected response for the PutFile operation, with the 'X-WOPI-ItemVersion' header set.
      • createBlobFromRequestBody

        protected Blob createBlobFromRequestBody​(String filename,
                                                 String mimeType)
        Creates a new blob from the request body, given a filename and an optional mimeType.
        Returns:
        the new blob
      • unlock

        protected Object unlock()
        Implements the Unlock operation.

        See Unlock.

      • refreshLock

        protected Object refreshLock()
        Implements the RefreshLock operation.

        See RefreshLock.

      • getMaxExpectedSize

        protected int getMaxExpectedSize​(String maxExpectedSizeHeader)
      • getHeader

        protected String getHeader​(String operation,
                                   String headerName,
                                   boolean nullable)
      • checkWritePropertiesPermission

        protected void checkWritePropertiesPermission​(String operation)
      • addHostCapabilitiesProperties

        protected void addHostCapabilitiesProperties​(Map<String,​Serializable> map)
      • addUserMetadataProperties

        protected void addUserMetadataProperties​(Map<String,​Serializable> map)
      • addUserPermissionsProperties

        protected void addUserPermissionsProperties​(Map<String,​Serializable> map)
      • getItemVersion

        protected String getItemVersion()
      • logRequest

        protected void logRequest​(String operation,
                                  String... headers)
      • logCondition

        protected void logCondition​(String condition)
      • logCondition

        protected void logCondition​(Supplier<String> condition)
      • logNuxeoAction

        protected void logNuxeoAction​(String action)
      • logNuxeoAction

        protected void logNuxeoAction​(Supplier<String> action)
      • logResponse

        protected void logResponse​(String operation,
                                   int status,
                                   String... headers)
      • logResponse

        protected void logResponse​(String operation,
                                   int status,
                                   Object entity,
                                   String... headers)
      • getHeaderString

        protected String getHeaderString​(String... headers)
      • getEntityString

        protected String getEntityString​(Object entity)