Package org.nuxeo.wopi.rest
Class FilesEndpoint
java.lang.Object
org.nuxeo.ecm.webengine.model.impl.AbstractResource<ResourceTypeImpl>
org.nuxeo.ecm.webengine.model.impl.DefaultObject
org.nuxeo.wopi.rest.FilesEndpoint
Implementation of the Files endpoint.
See Files endpoint.
- Since:
- 10.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
protected Blob
protected DocumentModel
protected String
protected jakarta.ws.rs.core.HttpHeaders
protected jakarta.servlet.http.HttpServletRequest
protected jakarta.servlet.http.HttpServletResponse
protected CoreSession
protected String
protected String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
protected void
protected void
protected void
protected void
protected Map
<String, Serializable> protected jakarta.ws.rs.core.Response
buildConflictResponse
(String operation, String lock) Builds a conflict response with the given WOPI lock as a header.protected jakarta.ws.rs.core.Response
buildItemVersionResponse
(String operation, Blob blob) jakarta.ws.rs.core.Response
Implements the CheckFileInfo operation.protected void
checkWritePropertiesPermission
(String operation) protected Blob
createBlobFromRequestBody
(String filename, String mimeType) Creates a new blob from the request body, given afilename
and an optionalmimeType
.protected DocumentModel
createVersionFromRequestBody
(String filename) jakarta.ws.rs.core.Response
jakarta.ws.rs.core.Response
doPostContents
(Operation operation) protected String
getCurrentLock
(String operation) Returns the WOPI lock if not null and throws aConflictException
otherwise.protected String
protected String
getEntityString
(Object entity) Implements the GetFile operation.protected String
protected String
protected String
getHeaderString
(String... headers) protected String
protected jakarta.ws.rs.core.Response
getLock()
Implements the GetLock operation.protected int
getMaxExpectedSize
(String maxExpectedSizeHeader) jakarta.ws.rs.core.Response
Implements the GetShareUrl operation.void
initialize
(Object... args) protected jakarta.ws.rs.core.Response
protected jakarta.ws.rs.core.Response
Implements the Lock and UnlockAndRelock operations.protected void
logCondition
(String condition) protected void
logCondition
(Supplier<String> condition) protected void
logNuxeoAction
(String action) protected void
logNuxeoAction
(Supplier<String> action) protected void
logRequest
(String operation, String... headers) protected void
logResponse
(String operation, int status, Object entity, String... headers) protected void
logResponse
(String operation, int status, String... headers) jakarta.ws.rs.core.Response
putFile()
Implements the PutFile operation.jakarta.ws.rs.core.Response
Implements the PutRelativeFile operation.protected jakarta.ws.rs.core.Response
Implements the RefreshLock operation.protected jakarta.ws.rs.core.Response
renameBlob
(String requestedName) Renames the blob with therequestedName
.jakarta.ws.rs.core.Response
Implements the RenameFile operation.protected jakarta.ws.rs.core.Response
unlock()
Implements the Unlock operation.protected jakarta.ws.rs.core.Response
unlockAndRelock
(String lock, String oldLock) protected jakarta.ws.rs.core.Response
unlockOrRefresh
(String operation, String lock, boolean unlock) protected jakarta.ws.rs.core.Response
Updates the document's blob from a new one.Methods inherited from class org.nuxeo.ecm.webengine.model.impl.DefaultObject
disptachAdapter, isAdapter
Methods inherited from class org.nuxeo.ecm.webengine.model.impl.AbstractResource
checkGuard, dispose, getActiveAdapter, getAdapter, getContext, getFacets, getLinks, getModule, getName, getNext, getNextSegment, getPath, getPrevious, getTemplate, getTrailingPath, getType, getURL, getView, hasFacet, initialize, isInstanceOf, isRoot, newAdapter, newObject, redirect, setNext, setPrevious, setRoot, toString
-
Field Details
-
request
@Context protected jakarta.servlet.http.HttpServletRequest request -
response
@Context protected jakarta.servlet.http.HttpServletResponse response -
httpHeaders
@Context protected jakarta.ws.rs.core.HttpHeaders httpHeaders -
session
-
doc
-
blob
-
xpath
-
fileId
-
baseURL
-
wopiBaseURL
-
-
Constructor Details
-
FilesEndpoint
public FilesEndpoint()
-
-
Method Details
-
initialize
- Overrides:
initialize
in classAbstractResource<ResourceTypeImpl>
-
checkFileInfo
@GET @Produces("application/json") public jakarta.ws.rs.core.Response checkFileInfo()Implements the CheckFileInfo operation.See CheckFileInfo.
-
getFile
@GET @Path("contents") public Blob getFile(@HeaderParam("X-WOPI-MaxExpectedSize") String maxExpectedSizeHeader) Implements the GetFile operation.See GetFile.
-
doPost
@POST public jakarta.ws.rs.core.Response doPost(@HeaderParam("X-WOPI-Override") Operation operation) -
lockOrUnlockAndRelock
protected jakarta.ws.rs.core.Response lockOrUnlockAndRelock()Implements the Lock and UnlockAndRelock operations.See Lock and UnlockAndRelock.
-
lock
-
buildItemVersionResponse
-
unlockAndRelock
-
getCurrentLock
Returns the WOPI lock if not null and throws aConflictException
otherwise.Must be called to check that a locked document is not locked by Nuxeo.
-
buildConflictResponse
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 jakarta.ws.rs.core.Response getLock()Implements the GetLock operation.See GetLock.
-
unlockOrRefresh
-
putRelativeFile
public jakarta.ws.rs.core.Response putRelativeFile()Implements the PutRelativeFile operation.New file creation is not supported, only the binary document conversion is supported.
See PutRelativeFile.
-
createVersionFromRequestBody
-
renameFile
public jakarta.ws.rs.core.Response renameFile()Implements the RenameFile operation.See RenameFile.
-
renameBlob
Renames the blob with therequestedName
.- Returns:
- the expected JSON response for the RenameFile operation.
-
doPostContents
@POST @Path("contents") public jakarta.ws.rs.core.Response doPostContents(@HeaderParam("X-WOPI-Override") Operation operation) -
putFile
public jakarta.ws.rs.core.Response putFile()Implements the PutFile operation.See PutFile.
-
updateBlob
protected jakarta.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
Creates a new blob from the request body, given afilename
and an optionalmimeType
.- Returns:
- the new blob
-
unlock
protected jakarta.ws.rs.core.Response unlock()Implements the Unlock operation.See Unlock.
-
refreshLock
protected jakarta.ws.rs.core.Response refreshLock()Implements the RefreshLock operation.See RefreshLock.
-
getMaxExpectedSize
-
getHeader
-
getHeader
-
checkWritePropertiesPermission
-
buildCheckFileInfoMap
-
addRequiredProperties
-
addHostCapabilitiesProperties
-
addUserMetadataProperties
-
addUserPermissionsProperties
-
addFileURLProperties
-
addBreadcrumbProperties
-
getItemVersion
-
getDocumentURL
-
logRequest
-
logCondition
-
logCondition
-
logNuxeoAction
-
logNuxeoAction
-
logResponse
-
logResponse
-
getHeaderString
-
getEntityString
-