Class AbstractProcessXDocReportServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
fr.opensagres.xdocreport.document.web.BaseXDocReportServlet
fr.opensagres.xdocreport.document.web.AbstractProcessXDocReportServlet
All Implemented Interfaces:
XDocBaseServletConstants, XDocProcessServletConstants, jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable
Direct Known Subclasses:
ProcessDispatcherXDocReportServlet

public abstract class AbstractProcessXDocReportServlet extends BaseXDocReportServlet implements XDocProcessServletConstants
Abstract XDoc Report servlet used to process report (generate report and remove report from cache).
See Also:
  • Constructor Details

    • AbstractProcessXDocReportServlet

      public AbstractProcessXDocReportServlet()
  • Method Details

    • init

      public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException
      Specified by:
      init in interface jakarta.servlet.Servlet
      Overrides:
      init in class BaseXDocReportServlet
      Throws:
      jakarta.servlet.ServletException
    • processRequest

      protected void processRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException
      Handles all requests (by default).
      Specified by:
      processRequest in class BaseXDocReportServlet
      Parameters:
      request - HttpServletRequest object containing client request
      response - HttpServletResponse object for the response
      Throws:
      jakarta.servlet.ServletException
      IOException
    • doRemoveReport

      protected void doRemoveReport(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException
      Remove report from the registry.
      Parameters:
      request -
      response -
      Throws:
      IOException
    • doRedirectAfterRemoveReport

      protected void doRedirectAfterRemoveReport(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException
      Throws:
      IOException
    • doDocumentArchive

      protected void doDocumentArchive(ProcessState state, String entryName, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException, jakarta.servlet.ServletException
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doSaveReport

      protected void doSaveReport(ProcessState processState, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException, jakarta.servlet.ServletException
      Save document archive of the report.
      Parameters:
      processState -
      request -
      response -
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doSaveEntry

      protected void doSaveEntry(ProcessState processState, String entryName, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException, jakarta.servlet.ServletException
      Extract entry from a report.
      Parameters:
      processState -
      request -
      response -
      Throws:
      IOException
      jakarta.servlet.ServletException
    • doGenerateReport

      protected boolean doGenerateReport(String entryName, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws jakarta.servlet.ServletException, IOException
      Throws:
      jakarta.servlet.ServletException
      IOException
    • getReport

      protected IXDocReport getReport(jakarta.servlet.http.HttpServletRequest request) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Parameters:
      request -
      Returns:
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • loadReport

      protected IXDocReport loadReport(String reportId, XDocReportRegistry registry, jakarta.servlet.http.HttpServletRequest request) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Load report.
      Parameters:
      reportId -
      registry -
      request -
      Returns:
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • isCacheReport

      protected boolean isCacheReport(String reportId, jakarta.servlet.http.HttpServletRequest request)
      Returns true if the report with the given id must be cached and false otherwise.
      Parameters:
      reportId - the report id.
      request - the HTTP request.
      Returns:
      true if the report with the given id must be cached and false otherwise.
    • isCacheOriginalDocument

      protected boolean isCacheOriginalDocument(String reportId, jakarta.servlet.http.HttpServletRequest request)
      Returns true if the original document "template" document with the given id must be cached and false otherwise.
      Parameters:
      reportId - the report id.
      request - the HTTP request.
      Returns:
      true if the original document "template" document with the given id must be cached and false otherwise.
    • getFieldsMetadata

      protected fr.opensagres.xdocreport.template.formatter.FieldsMetadata getFieldsMetadata(String reportId, jakarta.servlet.http.HttpServletRequest request)
      Returns the fields metadata to use for the report.
      Parameters:
      reportId - the report id.
      request - the HTTP request.
      Returns:
    • error

      protected void error(IXDocReport report, fr.opensagres.xdocreport.template.IContext context, DumperOptions dumperOptions, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Exception cause) throws jakarta.servlet.ServletException, IOException
      Invoked when there is an error thrown in any part of doRequest() processing.

      Default will send a simple HTML response indicating there was a problem.
      Parameters:
      dumperOptions -
      context -
      report -
      request - original HttpServletRequest from servlet container.
      response - HttpServletResponse object from servlet container.
      cause - Exception that was thrown by some other part of process.
      Throws:
      jakarta.servlet.ServletException
      IOException
    • getConverterId

      protected String getConverterId(IXDocReport report, jakarta.servlet.http.HttpServletRequest request)
      Returns the converter id.
      Parameters:
      request -
      Returns:
    • getOptionsConverter

      protected fr.opensagres.xdocreport.converter.Options getOptionsConverter(IXDocReport report, jakarta.servlet.http.HttpServletRequest request)
      Returns the options for the converter.
      Parameters:
      report - the report.
      request - the HTTP request.
      Returns:
    • prepareOptions

      protected void prepareOptions(fr.opensagres.xdocreport.converter.Options options, IXDocReport report, String converterId, jakarta.servlet.http.HttpServletRequest request)
      Initialize converter options with default settings.
      Parameters:
      options - the options converter.
      report - the report.
      converterId - the converter id.
      request - the HTTP request.
    • createWEBURIResolver

      public fr.opensagres.xdocreport.converter.IURIResolver createWEBURIResolver(IXDocReport report, String converterId, jakarta.servlet.http.HttpServletRequest request)
      Create the WEB URIResolver used to manage image with XHTML converter.
      Parameters:
      report - the report.
      converterId - the converter id.
      request - the HTTP request.
      Returns:
    • getOptionsDumper

      protected DumperOptions getOptionsDumper(IXDocReport report, jakarta.servlet.http.HttpServletRequest request)
      Returns the dumper options from the HTTP request and null otherwise.
      Parameters:
      report - the report.
      request - the HTTP request.
      Returns:
    • getDumperKind

      protected String getDumperKind(IXDocReport report, jakarta.servlet.http.HttpServletRequest request)
      Returns the dumper kind from the HTTP request.
      Parameters:
      report - the report.
      request - the HTTP request.
      Returns:
    • getFontEncoding

      protected String getFontEncoding(IXDocReport report, String converterId, jakarta.servlet.http.HttpServletRequest request)
      Returns the encoding to use for converter.
      Parameters:
      request -
      Returns:
    • isGenerateContentDisposition

      protected boolean isGenerateContentDisposition(String reportId, fr.opensagres.xdocreport.converter.MimeMapping mimeMapping, jakarta.servlet.http.HttpServletRequest request)
      Overrides:
      isGenerateContentDisposition in class BaseXDocReportServlet
    • getSourceStream

      protected abstract InputStream getSourceStream(String reportId, jakarta.servlet.http.HttpServletRequest request) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Returns input stream of the report to load identified with reportId.
      Parameters:
      reportId - report id.
      request - Http servlet request context.
      Returns:
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException
    • populateContext

      protected abstract void populateContext(fr.opensagres.xdocreport.template.IContext context, String reportId, jakarta.servlet.http.HttpServletRequest request) throws IOException, fr.opensagres.xdocreport.core.XDocReportException
      Put the Java model in the context for the report reportId.
      Parameters:
      context - XDocReport context to register Java data model.
      reportId - report id.
      request - Http servlet request context.
      Throws:
      IOException
      fr.opensagres.xdocreport.core.XDocReportException