Package org.nuxeo.wopi.jaxrs
Class FilesEndpoint
java.lang.Object
org.nuxeo.ecm.webengine.model.impl.AbstractResource<ResourceTypeImpl>
org.nuxeo.ecm.webengine.model.impl.DefaultObject
org.nuxeo.wopi.jaxrs.FilesEndpoint
Implementation of the Files endpoint.
See Files endpoint.
- Since:
- 10.3
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected Blob
protected DocumentModel
protected String
protected javax.ws.rs.core.HttpHeaders
protected javax.servlet.http.HttpServletRequest
protected javax.servlet.http.HttpServletResponse
protected CoreSession
protected String
protected String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
protected void
protected void
protected void
protected void
protected Map<String,
Serializable> protected javax.ws.rs.core.Response
buildConflictResponse
(String operation, String lock) Builds a conflict response with the given WOPI lock as a header.protected javax.ws.rs.core.Response
buildItemVersionResponse
(String operation, Blob blob) javax.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) 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 Object
getLock()
Implements the GetLock operation.protected int
getMaxExpectedSize
(String maxExpectedSizeHeader) Implements the GetShareUrl operation.void
initialize
(Object... args) protected Object
protected Object
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) putFile()
Implements the PutFile operation.Implements the PutRelativeFile operation.protected Object
Implements the RefreshLock operation.protected javax.ws.rs.core.Response
renameBlob
(String requestedName) Renames the blob with therequestedName
.Implements the RenameFile operation.protected Object
unlock()
Implements the Unlock operation.protected Object
unlockAndRelock
(String lock, String oldLock) protected Object
unlockOrRefresh
(String operation, String lock, boolean unlock) protected javax.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 javax.servlet.http.HttpServletRequest request -
response
@Context protected javax.servlet.http.HttpServletResponse response -
httpHeaders
@Context protected javax.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
public javax.ws.rs.core.Response checkFileInfo()Implements the CheckFileInfo operation.See CheckFileInfo.
-
getFile
Implements the GetFile operation.See GetFile.
-
doPost
-
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
Implements the GetLock operation.See GetLock.
-
unlockOrRefresh
-
putRelativeFile
Implements the PutRelativeFile operation.New file creation is not supported, only the binary document conversion is supported.
See PutRelativeFile.
-
createVersionFromRequestBody
-
renameFile
Implements the RenameFile operation.See RenameFile.
-
renameBlob
Renames the blob with therequestedName
.- Returns:
- the expected JSON response for the RenameFile operation.
-
doPostContents
-
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
Creates a new blob from the request body, given afilename
and an optionalmimeType
.- Returns:
- the new blob
-
unlock
Implements the Unlock operation.See Unlock.
-
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
-