Package org.faceless.publisher.resource
Interface ResourceLoader
- All Known Implementing Classes:
DocXResourceLoader
,EpubResourceLoader
,GeneralFontResourceLoader
,ImageResourceLoader
,KeyStoreResourceLoader
,LessStylesheetExtension
,MailExtension
,ODFResourceLoader
,PDFAudioResourceLoader
,PDFImageResourceLoader
,PDFVideoResourceLoader
,PKCS11KeyStoreResourceLoader
,ScssStylesheetExtension
,SVGImageResourceLoader
,TextResourceLoader
,UtilityResourceLoader
,XMLResourceLoader
public interface ResourceLoader
A ResourceLoader loads an Object from a URI
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Return true if this ResourceLoader requires the source URL to be trusted in order to load the specifiedResourceDescriptor
.load
(ResourceDescriptor d, Resource resource, URL2Connection con) Attempt to load a Resource from the specified URL2Connection.boolean
Return true if this ResourceLoader could load a descriptor of the specified type.
-
Method Details
-
supports
Return true if this ResourceLoader could load a descriptor of the specified type. The resourceClass, outputClass and mediaType of the descriptor should be checked as appropriate. The MediaType in particular will not be a wildcard for normal use; it may be a wildcard if we're being called fromResourceManager.getResourceLoader(org.faceless.publisher.type.MediaType, java.lang.Class<?>)
. -
isTrustRequired
Return true if this ResourceLoader requires the source URL to be trusted in order to load the specifiedResourceDescriptor
. The default implementation returns false.- Since:
- 1.3
- See Also:
-
load
Attempt to load a Resource from the specified URL2Connection. If the ResourceLoader applies (it should test the resource mediatype and class) then it should load the resource from the URL. If the URI has a fragment and the loaded resource to ALL fragments, it should change the URI to have no fragment. Likewise if any aspect of the MediaType does not apply (i.e. the encoding) then it should remove it, so the Resource describes the widest possible URI and MediaType that would match this object. Finally, on success this method should set the Object on the resource, or throw an exception on failure. The supplied "con" will have an InputStream that is mark-capable already. If the stream is a gzip or brotli compresed stream, decompression will already be applied. The mediatype wil be set on "d". Returning null from this object is considered an error condition - if that happens we shouldn't have got here, and the only reason we did was because "supports" for the same descriptor returned true.- Parameters:
d
- the descriptor of what type of flavor we want.resource
- the Resource we're populatingcon
- the URLConnection to load the resource from- Returns:
- the new Flavor, or null if it doesn't apply.
- Throws:
Exception
-