Class WOPIServiceImpl

All Implemented Interfaces:
Adaptable, Component, Extensible, TimestampedService, WOPIService

public class WOPIServiceImpl extends DefaultComponent implements WOPIService
Since:
10.3
  • Field Details

  • Constructor Details

    • WOPIServiceImpl

      public WOPIServiceImpl()
  • Method Details

    • start

      public void start(ComponentContext context)
      Description copied from interface: Component
      Start the component. This method is called after all the components were resolved and activated
      Specified by:
      start in interface Component
      Overrides:
      start in class DefaultComponent
    • stop

      public void stop(ComponentContext context)
      Description copied from interface: Component
      Stop the component.
      Specified by:
      stop in interface Component
      Overrides:
      stop in class DefaultComponent
    • 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

      protected List<String> getSupportedAppNames()
    • registerApp

      protected void registerApp(WOPIDiscovery.App app)
    • 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 interface WOPIService
    • getWOPIBlobInfo

      public WOPIBlobInfo getWOPIBlobInfo(Blob blob)
      Description copied from interface: WOPIService
      Returns a WOPIBlobInfo for the given blob if it is supported by WOPI, null otherwise.
      Specified by:
      getWOPIBlobInfo in interface WOPIService
    • isSupported

      public boolean isSupported(Blob blob)
      Description copied from interface: WOPIService
      Returns true if the given blob 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 interface WOPIService
    • getActionURL

      public String getActionURL(Blob blob, String action)
      Description copied from interface: WOPIService
      Returns the WOPI action url given a blob and an action.
      Specified by:
      getActionURL in interface WOPIService
    • getExtension

      protected String getExtension(Blob blob)
    • 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 interface WOPIService
    • 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 interface WOPIService
      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

      protected KeyValueStore getKeyValueStore()
    • checkDownloadBlob

      public boolean checkDownloadBlob(DocumentModel doc, String xpath, Blob blob)
      Description copied from interface: WOPIService
      Checks whether the download of the blob is allowed.
      Specified by:
      checkDownloadBlob in interface WOPIService
      Returns:
      true if download is allowed
    • updateCheckFileInfoProperties

      public Map<String,Serializable> updateCheckFileInfoProperties(Map<String,Serializable> checkFileInfoProperties)
      Specified by:
      updateCheckFileInfoProperties in interface WOPIService