Class ContentLoaderSingleton

java.lang.Object
se.idsec.signservice.integration.core.ContentLoaderSingleton
All Implemented Interfaces:
ContentLoader

public class ContentLoaderSingleton extends Object implements ContentLoader
A singleton to be used internally for loading resources. By default the DefaultContentLoader is used. This can be overridden by installing a customized content loader using setContentLoader(ContentLoader).
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
  • Method Details

    • getInstance

      public static ContentLoader getInstance()
      Gets the singleton instance of the global content loader.
      Returns:
      a ContentLoader
    • loadContent

      public byte[] loadContent(String resource) throws IOException
      Loads the contents of the given resource.

      Note: The Spring Framework style of representing a resource must be supported by implementations. For example: classpath:xyz.svg and file:/path/xyz.svg.

      Specified by:
      loadContent in interface ContentLoader
      Parameters:
      resource - the resource to load
      Returns:
      the contents as a byte array
      Throws:
      IOException - if the contents can not be loaded
    • setContentLoader

      public void setContentLoader(ContentLoader loader)
      If the global ContentLoader should be something else than DefaultContentLoader this method should be used to assign this.
      Parameters:
      loader - the content loader to set