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:
-
Field Summary
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_KEYFields 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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfr.opensagres.xdocreport.converter.IURIResolvercreateWEBURIResolver(IXDocReport report, String converterId, jakarta.servlet.http.HttpServletRequest request) Create the WEBURIResolverused to manage image with XHTML converter.protected voiddoDocumentArchive(ProcessState state, String entryName, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) protected booleandoGenerateReport(String entryName, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) protected voiddoRedirectAfterRemoveReport(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) protected voiddoRemoveReport(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Remove report from the registry.protected voiddoSaveEntry(ProcessState processState, String entryName, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Extract entry from a report.protected voiddoSaveReport(ProcessState processState, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Save document archive of the report.protected voiderror(IXDocReport report, fr.opensagres.xdocreport.template.IContext context, DumperOptions dumperOptions, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Exception cause) Invoked when there is an error thrown in any part of doRequest() processing.protected StringgetConverterId(IXDocReport report, jakarta.servlet.http.HttpServletRequest request) Returns the converter id.protected StringgetDumperKind(IXDocReport report, jakarta.servlet.http.HttpServletRequest request) Returns the dumper kind from the HTTP request.protected fr.opensagres.xdocreport.template.formatter.FieldsMetadatagetFieldsMetadata(String reportId, jakarta.servlet.http.HttpServletRequest request) Returns the fields metadata to use for the report.protected StringgetFontEncoding(IXDocReport report, String converterId, jakarta.servlet.http.HttpServletRequest request) Returns the encoding to use for converter.protected fr.opensagres.xdocreport.converter.OptionsgetOptionsConverter(IXDocReport report, jakarta.servlet.http.HttpServletRequest request) Returns the options for the converter.protected DumperOptionsgetOptionsDumper(IXDocReport report, jakarta.servlet.http.HttpServletRequest request) Returns the dumper options from the HTTP request and null otherwise.protected IXDocReportgetReport(jakarta.servlet.http.HttpServletRequest request) protected abstract InputStreamgetSourceStream(String reportId, jakarta.servlet.http.HttpServletRequest request) Returns input stream of the report to load identified withreportId.voidinit(jakarta.servlet.ServletConfig config) protected booleanisCacheOriginalDocument(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.protected booleanisCacheReport(String reportId, jakarta.servlet.http.HttpServletRequest request) Returns true if the report with the given id must be cached and false otherwise.protected booleanisGenerateContentDisposition(String reportId, fr.opensagres.xdocreport.converter.MimeMapping mimeMapping, jakarta.servlet.http.HttpServletRequest request) protected IXDocReportloadReport(String reportId, XDocReportRegistry registry, jakarta.servlet.http.HttpServletRequest request) Load report.protected abstract voidpopulateContext(fr.opensagres.xdocreport.template.IContext context, String reportId, jakarta.servlet.http.HttpServletRequest request) Put the Java model in the context for the reportreportId.protected voidprepareOptions(fr.opensagres.xdocreport.converter.Options options, IXDocReport report, String converterId, jakarta.servlet.http.HttpServletRequest request) Initialize converter options with default settings.protected voidprocessRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.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, prepareHTTPResponseMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, serviceMethods inherited from class jakarta.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
AbstractProcessXDocReportServlet
public AbstractProcessXDocReportServlet()
-
-
Method Details
-
init
public void init(jakarta.servlet.ServletConfig config) throws jakarta.servlet.ServletException - Specified by:
initin interfacejakarta.servlet.Servlet- Overrides:
initin classBaseXDocReportServlet- 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:
processRequestin classBaseXDocReportServlet- Parameters:
request- HttpServletRequest object containing client requestresponse- HttpServletResponse object for the response- Throws:
jakarta.servlet.ServletExceptionIOException
-
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:
IOExceptionjakarta.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:
IOExceptionjakarta.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:
IOExceptionjakarta.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.ServletExceptionIOException
-
getReport
protected IXDocReport getReport(jakarta.servlet.http.HttpServletRequest request) throws IOException, fr.opensagres.xdocreport.core.XDocReportException - Parameters:
request-- Returns:
- Throws:
IOExceptionfr.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:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-
isCacheReport
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.ServletExceptionIOException
-
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 WEBURIResolverused 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
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:
isGenerateContentDispositionin classBaseXDocReportServlet
-
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 withreportId.- Parameters:
reportId- report id.request- Http servlet request context.- Returns:
- Throws:
IOExceptionfr.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 reportreportId.- Parameters:
context- XDocReport context to register Java data model.reportId- report id.request- Http servlet request context.- Throws:
IOExceptionfr.opensagres.xdocreport.core.XDocReportException
-