Package org.nuxeo.wopi
Class WOPIServiceImpl
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.wopi.WOPIServiceImpl
- All Implemented Interfaces:
Adaptable
,Component
,Extensible
,TimestampedService
,WOPIService
- Since:
- 10.3
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
class
-
Field Summary
Modifier and TypeFieldDescriptionprotected CheckFileInfoUpdater
protected String
static final String
protected WOPIServiceImpl.WOPIDiscoveryInvalidator
protected PublicKey
static final String
static final String
protected PublicKey
static final String
protected static final String
static final String
static final String
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.http.impl.client.CloseableHttpClient
boolean
checkDownloadBlob
(DocumentModel doc, String xpath, Blob blob) Checks whether the download of the blob is allowed.protected void
configureProxy
(org.apache.http.impl.client.HttpClientBuilder builder) protected byte[]
protected void
getActionURL
(Blob blob, String action) Returns the WOPI action url given ablob
and anaction
.protected byte[]
protected String
getExtension
(Blob blob) protected KeyValueStore
getWOPIBlobInfo
(Blob blob) Returns aWOPIBlobInfo
for the given blob if it is supported by WOPI,null
otherwise.protected boolean
boolean
Returns @{code true} if WOPI is enabled,false
otherwise.boolean
isSupported
(Blob blob) Returnstrue
if the givenblob
is supported by WOPI,false
otherwise.protected void
protected boolean
loadDiscovery
(byte[] discoveryBytes) boolean
Refreshes the WOPI discovery: fetches the data from the discovery URL, stores it and loads it in memory.protected void
protected void
void
start
(ComponentContext context) Start the component.void
stop
(ComponentContext context) Stop the component.protected void
storeDiscovery
(byte[] discoveryBytes) protected void
updateCheckFileInfoProperties
(Map<String, Serializable> checkFileInfoProperties) boolean
verifyProofKey
(String proofKeyHeader, String oldProofKeyHeader, String url, String accessToken, String timestampHeader) Verifies that the request originate from Office Online.Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerContribution, registerExtension, setLastModified, setModifiedNow, setName, unregister, unregisterContribution, unregisterExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
XP_CHECK_FILE_INFO_UPDATER
- See Also:
-
PLACEHOLDER_IS_LICENSED_USER
- See Also:
-
PLACEHOLDER_IS_LICENSED_USER_VALUE
- See Also:
-
WOPI_PROPERTY_NAMESPACE
- See Also:
-
SUPPORTED_APP_NAMES_PROPERTY_KEY
- See Also:
-
DOWNLOAD_REASON
- See Also:
-
WOPI_DISCOVERY_INVAL_PUBSUB_TOPIC
- See Also:
-
extensionAppNames
-
extensionActionURLs
-
proofKey
-
oldProofKey
-
discoveryURL
-
invalidator
-
checkFileInfoUpdater
-
-
Constructor Details
-
WOPIServiceImpl
public WOPIServiceImpl()
-
-
Method Details
-
start
Description copied from interface:Component
Start the component. This method is called after all the components were resolved and activated- Specified by:
start
in interfaceComponent
- Overrides:
start
in classDefaultComponent
-
stop
Description copied from interface:Component
Stop the component.- Specified by:
stop
in interfaceComponent
- Overrides:
stop
in classDefaultComponent
-
hasDiscoveryURL
protected boolean hasDiscoveryURL() -
registerInvalidator
protected void registerInvalidator() -
unregisterInvalidator
protected void unregisterInvalidator() -
loadDiscovery
protected void loadDiscovery() -
loadDiscovery
protected boolean loadDiscovery(byte[] discoveryBytes) -
fireRefreshDiscovery
protected void fireRefreshDiscovery() -
getSupportedAppNames
-
registerApp
-
isEnabled
public boolean isEnabled()Description copied from interface:WOPIService
Returns @{code true} if WOPI is enabled,false
otherwise.The WOPI discovery XML file has been loaded.
- Specified by:
isEnabled
in interfaceWOPIService
-
getWOPIBlobInfo
Description copied from interface:WOPIService
Returns aWOPIBlobInfo
for the given blob if it is supported by WOPI,null
otherwise.- Specified by:
getWOPIBlobInfo
in interfaceWOPIService
-
isSupported
Description copied from interface:WOPIService
Returnstrue
if the givenblob
is supported by WOPI,false
otherwise.This method relies on checking that the blob's filename extension is supported by the WOPI discovery.
- Specified by:
isSupported
in interfaceWOPIService
-
getActionURL
Description copied from interface:WOPIService
Returns the WOPI action url given ablob
and anaction
.- Specified by:
getActionURL
in interfaceWOPIService
-
getExtension
-
verifyProofKey
public boolean verifyProofKey(String proofKeyHeader, String oldProofKeyHeader, String url, String accessToken, String timestampHeader) Description copied from interface:WOPIService
Verifies that the request originate from Office Online.- Specified by:
verifyProofKey
in interfaceWOPIService
-
refreshDiscovery
public boolean refreshDiscovery()Description copied from interface:WOPIService
Refreshes the WOPI discovery: fetches the data from the discovery URL, stores it and loads it in memory.- Specified by:
refreshDiscovery
in interfaceWOPIService
- Returns:
true
if refreshing the discovery has succeeded,false
otherwise
-
fetchDiscovery
protected byte[] fetchDiscovery() -
buildHttpClient
protected org.apache.http.impl.client.CloseableHttpClient buildHttpClient() -
configureProxy
protected void configureProxy(org.apache.http.impl.client.HttpClientBuilder builder) -
getDiscovery
protected byte[] getDiscovery() -
storeDiscovery
protected void storeDiscovery(byte[] discoveryBytes) -
getKeyValueStore
-
checkDownloadBlob
Description copied from interface:WOPIService
Checks whether the download of the blob is allowed.- Specified by:
checkDownloadBlob
in interfaceWOPIService
- Returns:
true
if download is allowed
-
updateCheckFileInfoProperties
public Map<String,Serializable> updateCheckFileInfoProperties(Map<String, Serializable> checkFileInfoProperties) - Specified by:
updateCheckFileInfoProperties
in interfaceWOPIService
-