Class Resource

java.lang.Object
org.faceless.publisher.resource.Resource

public class Resource extends Object
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

    Constructors
    Constructor
    Description
    Resource(URL2 uri, ReportFactory reportFactory)
    Create a new Resource associated with the specified URL
  • Method Summary

    Modifier and Type
    Method
    Description
    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)
    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
    Return 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 known
    If 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 as getURL().
    If this resource is specific to a Document, return the document, otherwise return null
    Return the ReportFactory that owns this resource
    Return the URL for the Resource

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Resource

      public Resource(URL2 uri, ReportFactory reportFactory)
      Create a new Resource associated with the specified URL
      Parameters:
      uri - the URL
      reportFactory - the ReportFactory that owns this resource
  • Method Details

    • getReportFactory

      public ReportFactory getReportFactory()
      Return the ReportFactory that owns this resource
      Returns:
      the factory
    • getReport

      public Report getReport()
      If this resource is specific to a Document, return the document, otherwise return null
    • getLoadingThread

      public Thread 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

      public URL2 getURL()
      Return the URL for the Resource
    • getRedirectURL

      public URL2 getRedirectURL()
      Return the final URL that was actually used to load the resource, which often be the same as getURL().
    • getAccessControlAllowOrigin

      public String 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

      public MediaType 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

      public String 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

      public Exception 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