fr.opensagres.xdocreport.document.web
Class AbstractProcessXDocReportServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by fr.opensagres.xdocreport.document.web.BaseXDocReportServlet
              extended by fr.opensagres.xdocreport.document.web.AbstractProcessXDocReportServlet
All Implemented Interfaces:
XDocBaseServletConstants, XDocProcessServletConstants, Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
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:
Serialized Form

Field Summary
 
Fields inherited from interface fr.opensagres.xdocreport.document.web.XDocProcessServletConstants
CONVERTER_ID_HTTP_PARAM, DOWNLOAD_DISPATCH, DUMPER_KIND_HTTP_PARAM, FONT_ENCODING_HTTP_PARAM, REMOVE_DISPATCH, VIEW_DISPATCH
 
Fields inherited from interface fr.opensagres.xdocreport.document.web.XDocBaseServletConstants
DISPATCH_HTTP_PARAM, ENTRY_NAME_HTTP_PARAM, PROCESS_STATE_HTTP_PARAM, REPORT_ID_HTTP_PARAM, TEMPLATE_ENGINE_ID_HTTP_PARAM, TEMPLATE_ENGINE_KIND_HTTP_PARAM, XDOCREPORT_ATTR_KEY, XDOCREPORTREGISTRY_SESSION_KEY
 
Constructor Summary
AbstractProcessXDocReportServlet()
           
 
Method Summary
 IURIResolver createWEBURIResolver(IXDocReport report, String converterId, javax.servlet.http.HttpServletRequest request)
          Create the WEB URIResolver used to manage image with XHTML converter.
protected  void doDocumentArchive(ProcessState state, String entryName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  boolean doGenerateReport(String entryName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  void doRedirectAfterRemoveReport(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
protected  void doRemoveReport(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Remove report from the registry.
protected  void doSaveEntry(ProcessState processState, String entryName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Extract entry from a report.
protected  void doSaveReport(ProcessState processState, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Save document archive of the report.
protected  void error(IXDocReport report, IContext context, DumperOptions dumperOptions, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Exception cause)
          Invoked when there is an error thrown in any part of doRequest() processing.
protected  String getConverterId(IXDocReport report, javax.servlet.http.HttpServletRequest request)
          Returns the converter id.
protected  String getDumperKind(IXDocReport report, javax.servlet.http.HttpServletRequest request)
          Returns the dumper kind from the HTTP request.
protected  FieldsMetadata getFieldsMetadata(String reportId, javax.servlet.http.HttpServletRequest request)
           
protected  String getFontEncoding(IXDocReport report, String converterId, javax.servlet.http.HttpServletRequest request)
          Returns the encoding to use for converter.
protected  Options getOptionsConverter(IXDocReport report, javax.servlet.http.HttpServletRequest request)
          Returns the options for the converter.
protected  DumperOptions getOptionsDumper(IXDocReport report, javax.servlet.http.HttpServletRequest request)
          Returns the dumper options from the HTTP request and null otherwise.
protected  IXDocReport getReport(javax.servlet.http.HttpServletRequest request)
           
protected abstract  InputStream getSourceStream(String reportId, javax.servlet.http.HttpServletRequest request)
          Returns input stream of the report to load identified with reportId.
 void init(javax.servlet.ServletConfig config)
           
protected  boolean isCacheOriginalDocument(String reportId, javax.servlet.http.HttpServletRequest request)
           
protected  boolean isGenerateContentDisposition(String reportId, MimeMapping mimeMapping, javax.servlet.http.HttpServletRequest request)
           
protected  IXDocReport loadReport(String reportId, XDocReportRegistry registry, javax.servlet.http.HttpServletRequest request)
          Load report.
protected abstract  void populateContext(IContext context, String reportId, javax.servlet.http.HttpServletRequest request)
          Put the Java model in the context for the report reportId.
protected  void prepareOptions(Options options, IXDocReport report, String converterId, javax.servlet.http.HttpServletRequest request)
          Initialize converter options with default settings.
protected  void processRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Handles all requests (by default).
 
Methods inherited from class fr.opensagres.xdocreport.document.web.BaseXDocReportServlet
clearRegistryFromHTTPSession, disableHTTPResponCache, doGet, doPost, getContentDisposition, getContentDisposition, getDispatchParameter, getEntryName, getProcessState, getRegistry, getRegistryFromHTTPSession, getReportId, getTemplateEngine, getTemplateEngine, getTemplateEngine, getTemplateEngineId, getTemplateEngineKind, getTemplateEngineKind, isDisableHTTPResponCache, prepareHTTPResponse, prepareHTTPResponse
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractProcessXDocReportServlet

public AbstractProcessXDocReportServlet()
Method Detail

init

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

processRequest

protected void processRequest(javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
                       throws javax.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:
javax.servlet.ServletException
IOException

doRemoveReport

protected void doRemoveReport(javax.servlet.http.HttpServletRequest request,
                              javax.servlet.http.HttpServletResponse response)
                       throws IOException
Remove report from the registry.

Parameters:
request -
response -
Throws:
IOException

doRedirectAfterRemoveReport

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

doDocumentArchive

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

doSaveReport

protected void doSaveReport(ProcessState processState,
                            javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response)
                     throws IOException,
                            javax.servlet.ServletException
Save document archive of the report.

Parameters:
processState -
request -
response -
Throws:
IOException
javax.servlet.ServletException

doSaveEntry

protected void doSaveEntry(ProcessState processState,
                           String entryName,
                           javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response)
                    throws IOException,
                           javax.servlet.ServletException
Extract entry from a report.

Parameters:
processState -
request -
response -
Throws:
IOException
javax.servlet.ServletException

doGenerateReport

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

getReport

protected IXDocReport getReport(javax.servlet.http.HttpServletRequest request)
                         throws IOException,
                                XDocReportException
Parameters:
request -
Returns:
Throws:
IOException
XDocReportException

loadReport

protected IXDocReport loadReport(String reportId,
                                 XDocReportRegistry registry,
                                 javax.servlet.http.HttpServletRequest request)
                          throws IOException,
                                 XDocReportException
Load report.

Parameters:
reportId -
registry -
request -
Returns:
Throws:
IOException
XDocReportException

isCacheOriginalDocument

protected boolean isCacheOriginalDocument(String reportId,
                                          javax.servlet.http.HttpServletRequest request)

getFieldsMetadata

protected FieldsMetadata getFieldsMetadata(String reportId,
                                           javax.servlet.http.HttpServletRequest request)

error

protected void error(IXDocReport report,
                     IContext context,
                     DumperOptions dumperOptions,
                     javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response,
                     Exception cause)
              throws javax.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:
javax.servlet.ServletException
IOException

getConverterId

protected String getConverterId(IXDocReport report,
                                javax.servlet.http.HttpServletRequest request)
Returns the converter id.

Parameters:
request -
Returns:

getOptionsConverter

protected Options getOptionsConverter(IXDocReport report,
                                      javax.servlet.http.HttpServletRequest request)
Returns the options for the converter.

Parameters:
report - the report.
request - the HTTP request.
Returns:

prepareOptions

protected void prepareOptions(Options options,
                              IXDocReport report,
                              String converterId,
                              javax.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 IURIResolver createWEBURIResolver(IXDocReport report,
                                         String converterId,
                                         javax.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,
                                         javax.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,
                               javax.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,
                                 javax.servlet.http.HttpServletRequest request)
Returns the encoding to use for converter.

Parameters:
request -
Returns:

isGenerateContentDisposition

protected boolean isGenerateContentDisposition(String reportId,
                                               MimeMapping mimeMapping,
                                               javax.servlet.http.HttpServletRequest request)
Overrides:
isGenerateContentDisposition in class BaseXDocReportServlet

getSourceStream

protected abstract InputStream getSourceStream(String reportId,
                                               javax.servlet.http.HttpServletRequest request)
                                        throws IOException,
                                               XDocReportException
Returns input stream of the report to load identified with reportId.

Parameters:
reportId - report id.
request - Http servlet request context.
Returns:
Throws:
IOException
XDocReportException

populateContext

protected abstract void populateContext(IContext context,
                                        String reportId,
                                        javax.servlet.http.HttpServletRequest request)
                                 throws IOException,
                                        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
XDocReportException


Copyright © 2013. All rights reserved.