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 ContentLoaderGets the singleton instance of the global content loader.byte[]loadContent(String resource) Loads the contents of the given resource.voidsetContentLoader(ContentLoader loader) If the globalContentLoadershould be something else thanDefaultContentLoaderthis 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.svgandfile:/path/xyz.svg.- Specified by:
loadContentin 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 globalContentLoadershould be something else thanDefaultContentLoaderthis method should be used to assign this.- Parameters:
loader- the content loader to set
-