Class SpiderExtension

java.lang.Object
org.faceless.publisher.ext.SpiderExtension
All Implemented Interfaces:
ReportFactoryExtension

public class SpiderExtension extends Object implements ReportFactoryExtension
A ReportFactoryExtension that will listen for any hyperlinks in the document, consider whether the document being linked to is "local" and if it is, attach it to the PDF as another PDF and redirect all links to that document. This allows you to build up a single PDF that contains an entire folder or website.
  • Constructor Details

    • SpiderExtension

      public SpiderExtension()
  • Method Details

    • unregister

      public void unregister(Report report)
      Description copied from interface: ReportFactoryExtension
      Notify this object when the Report it was registered on has completed parsing. Will be called when this object is added to the list returned by ReportFactory.getReportFactoryExtensions(). The default implementation is a no-op.
      Specified by:
      unregister in interface ReportFactoryExtension
    • process

      public Report process(org.faceless.publisher.ext.SpiderExtension.State state)
      Called whenever a hyperlink to an external resource is added to a Report. Attachments can be made by returning the report to attach the document at the target URL to, or calling state.addAttachment directly. The defaut implementation attaches the PDF to the top document in the stack if "isLocal" returns true.
      Parameters:
      state - the current state.
      Returns:
      the report to attach the resource to, or null to not attach anything.
    • isLocal

      public boolean isLocal(URL2 base, URL2 target)
      Return true if a target URL is considered "local" for the base URL, and therefore attachable.