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 Stringprotected Blobprotected DocumentModelprotected Stringprotected jakarta.ws.rs.core.HttpHeadersprotected jakarta.servlet.http.HttpServletRequestprotected jakarta.servlet.http.HttpServletResponseprotected CoreSessionprotected Stringprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected Map<String, Serializable> protected jakarta.ws.rs.core.ResponsebuildConflictResponse(String operation, String lock) Builds a conflict response with the given WOPI lock as a header.protected jakarta.ws.rs.core.ResponsebuildItemVersionResponse(String operation, Blob blob) jakarta.ws.rs.core.ResponseImplements the CheckFileInfo operation.protected voidcheckWritePropertiesPermission(String operation) protected BlobcreateBlobFromRequestBody(String filename, String mimeType) Creates a new blob from the request body, given afilenameand an optionalmimeType.protected DocumentModelcreateVersionFromRequestBody(String filename) jakarta.ws.rs.core.Responsejakarta.ws.rs.core.ResponsedoPostContents(Operation operation) protected StringgetCurrentLock(String operation) Returns the WOPI lock if not null and throws aConflictExceptionotherwise.protected Stringprotected StringgetEntityString(Object entity) Implements the GetFile operation.protected Stringprotected Stringprotected StringgetHeaderString(String... headers) protected Stringprotected jakarta.ws.rs.core.ResponsegetLock()Implements the GetLock operation.protected intgetMaxExpectedSize(String maxExpectedSizeHeader) jakarta.ws.rs.core.ResponseImplements the GetShareUrl operation.voidinitialize(Object... args) protected jakarta.ws.rs.core.Responseprotected jakarta.ws.rs.core.ResponseImplements the Lock and UnlockAndRelock operations.protected voidlogCondition(String condition) protected voidlogCondition(Supplier<String> condition) protected voidlogNuxeoAction(String action) protected voidlogNuxeoAction(Supplier<String> action) protected voidlogRequest(String operation, String... headers) protected voidlogResponse(String operation, int status, Object entity, String... headers) protected voidlogResponse(String operation, int status, String... headers) jakarta.ws.rs.core.ResponseputFile()Implements the PutFile operation.jakarta.ws.rs.core.ResponseImplements the PutRelativeFile operation.protected jakarta.ws.rs.core.ResponseImplements the RefreshLock operation.protected jakarta.ws.rs.core.ResponserenameBlob(String requestedName) Renames the blob with therequestedName.jakarta.ws.rs.core.ResponseImplements the RenameFile operation.protected jakarta.ws.rs.core.Responseunlock()Implements the Unlock operation.protected jakarta.ws.rs.core.ResponseunlockAndRelock(String lock, String oldLock) protected jakarta.ws.rs.core.ResponseunlockOrRefresh(String operation, String lock, boolean unlock) protected jakarta.ws.rs.core.ResponseUpdates the document's blob from a new one.Methods inherited from class org.nuxeo.ecm.webengine.model.impl.DefaultObject
disptachAdapter, isAdapterMethods 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:
initializein 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 aConflictExceptionotherwise.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 afilenameand 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
-