Class WopiAccessHandler
The wopi client endpoint can be set by the environment variable WOPI_PUBLIC_ENDPOINT
Optional a discoveryEndpoint (WOPI_DISCOVERY_ENDPOINT) can be set to resolve the WOPI Client endpoints dynamically. In most cases this is not necessary and a wopi.public.endpoint can be set.
The method cacheFileData and fetchFileData are used to store a modified file object temporarily into the wopi local file cache.
- Version:
- 1.0
- Author:
- rsoika
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcacheFileData(String accessToken, org.imixs.workflow.FileData fileData) This method caches a fileData temporarily into the servers filesystem.voidclearFileCache(String accessToken) Deletes all existing files cached for a given token.org.imixs.workflow.FileDatafetchFileData(String accessToken, String filename) This method tries the fetch a file content from the local wopi file cache.generateAccessToken(String userid, String username) Generates a new access tokenList<org.imixs.workflow.FileData>getAllFileData(String accessToken) This method is called by the WopiController before a workitem is processed.getClientEndpointByFilename(String filename) Returns a WOPI Client endpoint by a file extensiongetClientEndpointByMimeType(String mimeType) Returns a WOPI Client endpoint by a file mime typepurgeAccessToken(String access_token) For some reason the LibreOffice Online adds additional query params starting with '?'jakarta.json.JsonObjectvalidateAccessToken(String access_token) Validates if a given access_token is still valid.
-
Constructor Details
-
WopiAccessHandler
public WopiAccessHandler()
-
-
Method Details
-
cacheFileData
public void cacheFileData(String accessToken, org.imixs.workflow.FileData fileData) throws IOException This method caches a fileData temporarily into the servers filesystem. The cached fileData is identified by the accesstoken+filename (with a hash value).The method also deletes outdated cached files.
- Parameters:
jsessionid-file-- Throws:
IOException
-
fetchFileData
This method tries the fetch a file content from the local wopi file cache.If no cached file data exits, the method returns null.
- Parameters:
accessToken-- Returns:
- cached fileData object or null if no object was found for the given accessToken
- Throws:
IOException
-
getAllFileData
This method is called by the WopiController before a workitem is processed. The method returns all modified cached files in a list of FileData objects.- Parameters:
accessToken-- Returns:
-
clearFileCache
Deletes all existing files cached for a given token.- Parameters:
accessToken-
-
generateAccessToken
Generates a new access token- Returns:
- Throws:
org.imixs.jwt.JWTException
-
validateAccessToken
Validates if a given access_token is still valid.The method also clears the token form invalid query params. For some reasons Collabora sends additional query params starting with '?' which is not expected here!
In case the token is valid, the method returns the paylod, otherwise the method returns null.
- Parameters:
access_token-- Returns:
- the token payload or null if the token is not valid
-
purgeAccessToken
For some reason the LibreOffice Online adds additional query params starting with '?' into the access token, with is not expected. Thes helper method removes such parts of the token.- Parameters:
accesstoken-- Returns:
- clean access token
-
getClientEndpointByFilename
Returns a WOPI Client endpoint by a file extensionIf wopi.public.endpoint is set than this endpoint will be returned. If not the endpoint is resolved dynamically by the wopi.desovery.endpoint
- Parameters:
ext-- Returns:
-
getClientEndpointByMimeType
Returns a WOPI Client endpoint by a file mime typeIf wopi.public.endpoint is set than this endpoint will be returned. If not the endpoint is resolved dynamically by the wopi.desovery.endpoint
- Parameters:
ext-- Returns:
-