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
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Blobprotected DocumentModelprotected Stringprotected javax.ws.rs.core.HttpHeadersprotected javax.servlet.http.HttpServletRequestprotected javax.servlet.http.HttpServletResponseprotected CoreSessionprotected Stringprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected Map<String,Serializable> protected javax.ws.rs.core.ResponsebuildConflictResponse(String operation, String lock) Builds a conflict response with the given WOPI lock as a header.protected javax.ws.rs.core.ResponsebuildItemVersionResponse(String operation, Blob blob) javax.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) doPostContents(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 ObjectgetLock()Implements the GetLock operation.protected intgetMaxExpectedSize(String maxExpectedSizeHeader) Implements the GetShareUrl operation.voidinitialize(Object... args) protected Objectprotected ObjectImplements 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) putFile()Implements the PutFile operation.Implements the PutRelativeFile operation.protected ObjectImplements the RefreshLock operation.protected javax.ws.rs.core.ResponserenameBlob(String requestedName) Renames the blob with therequestedName.Implements the RenameFile operation.protected Objectunlock()Implements the Unlock operation.protected ObjectunlockAndRelock(String lock, String oldLock) protected ObjectunlockOrRefresh(String operation, String lock, boolean unlock) protected javax.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 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:
initializein 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 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
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 afilenameand 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
-