Package org.faceless.publisher.resource
Class Resource
java.lang.Object
org.faceless.publisher.resource.Resource
A Resource represents an resource such as an HTML page, a stylesheet, an image,
a font etc. Each Resource can have multiple
flavors
, each
of which is a different view on the resource depending on how, and where it is to
be used.-
Constructor Summary
ConstructorDescriptionResource
(URL2 uri, ReportFactory reportFactory) Create a new Resource associated with the specified URL -
Method Summary
Modifier and TypeMethodDescriptionReturn the "Access-Control-Allow-Origin" header, which will always be either "*" or a URL origin string (if not set by the server, it will be set to the origin of the requested URL)Return the Exception that goes with the Error Message, or null if there is no error or if the error does not have an associated ExceptionReturn the ErrorMessage that was set during the last attempt to load, or null if there is no error.long
Return the last-modified time, in ms since the UNIX epoch, or 0 if not knownIf the resource is currently being loaded, return the Thread loading that resource.Return the MediaType for the Resource, which will be null until we have attemped to load it for the first time.Return the final URL that was actually used to load the resource, which often be the same asgetURL()
.If this resource is specific to a Document, return the document, otherwise return nullReturn the ReportFactory that owns this resourcegetURL()
Return the URL for the Resource
-
Constructor Details
-
Resource
Create a new Resource associated with the specified URL- Parameters:
uri
- the URLreportFactory
- the ReportFactory that owns this resource
-
-
Method Details
-
getReportFactory
Return the ReportFactory that owns this resource- Returns:
- the factory
-
getReport
If this resource is specific to a Document, return the document, otherwise return null -
getLoadingThread
If the resource is currently being loaded, return the Thread loading that resource. A call to "load" will block until this method returns null. If this method returns the current thread, a resource is tryign to load itself. -
getURL
Return the URL for the Resource -
getRedirectURL
Return the final URL that was actually used to load the resource, which often be the same asgetURL()
. -
getAccessControlAllowOrigin
Return the "Access-Control-Allow-Origin" header, which will always be either "*" or a URL origin string (if not set by the server, it will be set to the origin of the requested URL) -
getMediaType
Return the MediaType for the Resource, which will be null until we have attemped to load it for the first time. -
getLastModified
public long getLastModified()Return the last-modified time, in ms since the UNIX epoch, or 0 if not known -
getErrorMessage
Return the ErrorMessage that was set during the last attempt to load, or null if there is no error. This message applies to the Resource as a whole, for example if there was an HTTP 404 while trying to load. -
getErrorException
Return the Exception that goes with the Error Message, or null if there is no error or if the error does not have an associated Exception
-