Class ContentLoaderSingleton
java.lang.Object
se.idsec.signservice.integration.core.ContentLoaderSingleton
- All Implemented Interfaces:
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 Summary
Modifier and TypeMethodDescriptionstatic ContentLoader
Gets the singleton instance of the global content loader.byte[]
loadContent
(String resource) Loads the contents of the given resource.void
setContentLoader
(ContentLoader loader) If the globalContentLoader
should be something else thanDefaultContentLoader
this method should be used to assign this.
-
Method Details
-
getInstance
Gets the singleton instance of the global content loader.- Returns:
- a ContentLoader
-
loadContent
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
andfile:/path/xyz.svg
.- Specified by:
loadContent
in interfaceContentLoader
- Parameters:
resource
- the resource to load- Returns:
- the contents as a byte array
- Throws:
IOException
- if the contents can not be loaded
-
setContentLoader
If the globalContentLoader
should be something else thanDefaultContentLoader
this method should be used to assign this.- Parameters:
loader
- the content loader to set
-