Package org.mapfish.print.servlet
Class MapPrinterServlet
java.lang.Object
org.mapfish.print.servlet.BaseMapServlet
org.mapfish.print.servlet.MapPrinterServlet
The default servlet.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe url path to cancel a print task.static final StringThe url path for capabilities requests.static final StringThe url path to create and get a report.static final StringThe url path to get a sample print request.static final StringThe url path to get the list of fonts available to geotools.static final StringThe application ID which indicates the configuration file to load.static final StringThe json tag referring to the attributes.static final StringIf the job is done (value is true) or not (value is false).static final StringThe json key in the create report and status responses containing a link to download the report.static final StringThe elapsed time in ms from the point the job started.static final StringThe key containing an error message for failed jobs.static final StringThe JSON key in the request spec that contains the java font family name.static final StringThe JSON key in the request spec that contains the font families names.static final StringThe JSON key in the request spec that contains the font families names.static final StringThe JSON key in the request spec that contains the font name.static final StringThe JSON key in the request spec that contains the font styles.static final StringThe JSON key in the request spec that contains the font weight.static final StringThe JSON key in the request spec that contains the font config fonts.static final StringThe JSON key in the request spec that contains the outputFormat.static final StringThe JSON key in the request spec that contains the Jasper report fonts.static final StringThe key containing the print job reference ID in the create report response.static final StringThe json property to add the request headers from the print request.static final StringThe status of the job.static final StringThe json key in the create report response containing a link to get the status of the print job.static final StringA rough estimate for the time in ms the job still has to wait in the queue until it starts processing.static final StringThe url path to list all registered configurations.static final StringThe url path to create a print task and to get a finished print.static final StringThe url path to get the status for a print task. -
Constructor Summary
ConstructorsConstructorDescriptionMapPrinterServlet(JobManager jobManager, List<ReportLoader> reportLoaders, MapPrinterFactory printerFactory, org.springframework.context.ApplicationContext context, ServletInfo servletInfo, MapPrinterFactory mapPrinterFactory, com.codahale.metrics.MetricRegistry metricRegistry) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidcancelPath(String referenceId, javax.servlet.http.HttpServletResponse statusResponse) Cancel a job.final voidcancelSpecificAppId(String appId, String referenceId, javax.servlet.http.HttpServletResponse statusResponse) Cancel a job.final voidcreateReport(String appId, String format, String requestData, javax.servlet.http.HttpServletRequest createReportRequest, javax.servlet.http.HttpServletResponse createReportResponse) Add the print job to the job queue.final voidcreateReport(String format, String requestData, javax.servlet.http.HttpServletRequest createReportRequest, javax.servlet.http.HttpServletResponse createReportResponse) Add the print job to the job queue.final voidcreateReportAndGet(String appId, String format, String requestData, boolean inline, javax.servlet.http.HttpServletRequest createReportRequest, javax.servlet.http.HttpServletResponse createReportResponse) add the print job to the job queue.final voidcreateReportAndGetNoAppId(String format, String requestData, boolean inline, javax.servlet.http.HttpServletRequest createReportRequest, javax.servlet.http.HttpServletResponse createReportResponse) add the print job to the job queue.final voidgetCapabilities(boolean pretty, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse capabilitiesResponse) To get (in JSON) the information about the available formats and CO.final voidgetCapabilities(String appId, boolean pretty, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse capabilitiesResponse) To get (in JSON) the information about the available formats and CO.final voidgetExampleRequest(String appId, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse getExampleResponse) Get a sample request for the app.final voidgetExampleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse getExampleResponse) Get a sample request for the app.protected final org.json.JSONObjectgetHeaders(javax.servlet.http.HttpServletRequest httpServletRequest) Read the headers from the request.final voidgetReportPath(String referenceId, boolean inline, javax.servlet.http.HttpServletResponse getReportResponse) To get the PDF created previously.final voidgetReportSpecificAppId(String appId, String referenceId, boolean inline, javax.servlet.http.HttpServletResponse getReportResponse) To get the PDF created previously.final voidgetStatusPath(String referenceId, javax.servlet.http.HttpServletRequest statusRequest, javax.servlet.http.HttpServletResponse statusResponse) Get a status report on a job.final voidgetStatusSpecificAppId(String appId, String referenceId, javax.servlet.http.HttpServletRequest statusRequest, javax.servlet.http.HttpServletResponse statusResponse) Get a status report on a job.final voidlistAppIds(javax.servlet.http.HttpServletResponse listAppsResponse) To get (in JSON) the information about the available formats and CO.final voidlistAvailableFonts(javax.servlet.http.HttpServletResponse response) List the available fonts on the system.final voidsetMaxCreateAndGetWaitTimeInSeconds(long maxCreateAndGetWaitTimeInSeconds) Maximum time to wait for a createAndGet request to complete before returning an error.Methods inherited from class org.mapfish.print.servlet.BaseMapServlet
error, getBaseUrl, setCache, setCacheDuration, setNoCache
-
Field Details
-
CAPABILITIES_URL
The url path for capabilities requests.- See Also:
-
LIST_APPS_URL
The url path to list all registered configurations.- See Also:
-
EXAMPLE_REQUEST_URL
The url path to get a sample print request.- See Also:
-
CREATE_AND_GET_URL
The url path to create and get a report.- See Also:
-
STATUS_URL
The url path to get the status for a print task.- See Also:
-
CANCEL_URL
The url path to cancel a print task.- See Also:
-
REPORT_URL
The url path to create a print task and to get a finished print.- See Also:
-
FONTS_URL
The url path to get the list of fonts available to geotools.- See Also:
-
JSON_ERROR
The key containing an error message for failed jobs.- See Also:
-
JSON_APP
The application ID which indicates the configuration file to load.- See Also:
-
JSON_DONE
If the job is done (value is true) or not (value is false).Part of the
getStatus(String, String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)response.- See Also:
-
JSON_STATUS
The status of the job. One of the following values:- waiting
- running
- finished
- canceled
- error
getStatus(String, String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)response- See Also:
-
JSON_ELAPSED_TIME
The elapsed time in ms from the point the job started. If the job is finished, this is the duration it took to process the job.Part of the
getStatus(String, String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)response.- See Also:
-
JSON_WAITING_TIME
A rough estimate for the time in ms the job still has to wait in the queue until it starts processing.Part of the
getStatus(String, String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)response.- See Also:
-
JSON_PRINT_JOB_REF
The key containing the print job reference ID in the create report response.- See Also:
-
JSON_STATUS_LINK
The json key in the create report response containing a link to get the status of the print job.- See Also:
-
JSON_DOWNLOAD_LINK
The json key in the create report and status responses containing a link to download the report.- See Also:
-
JSON_OUTPUT_FORMAT
The JSON key in the request spec that contains the outputFormat. This value will be put into the spec by the servlet. there is not need for the post to do this.- See Also:
-
JSON_ATTRIBUTES
The json tag referring to the attributes.- See Also:
-
JSON_REQUEST_HEADERS
The json property to add the request headers from the print request.The request headers from the print request are needed by certain processors, the headers are added to the request JSON data for those processors.
- See Also:
-
JSON_OUTPUT_JASPERREPORT_FONTS
The JSON key in the request spec that contains the Jasper report fonts.- See Also:
-
JSON_OUTPUT_FONTS
The JSON key in the request spec that contains the font config fonts.- See Also:
-
JSON_OUTPUT_FONT_FAMILY
The JSON key in the request spec that contains the java font family name.- See Also:
-
JSON_OUTPUT_FONTCONFIG
The JSON key in the request spec that contains the font families names.- See Also:
-
JSON_OUTPUT_FONTCONFIG_FAMILIES
The JSON key in the request spec that contains the font families names.- See Also:
-
JSON_OUTPUT_FONTCONFIG_NAME
The JSON key in the request spec that contains the font name.- See Also:
-
JSON_OUTPUT_FONTCONFIG_STYLES
The JSON key in the request spec that contains the font styles.- See Also:
-
JSON_OUTPUT_FONTCONFIG_WEIGHT
The JSON key in the request spec that contains the font weight.- See Also:
-
-
Constructor Details
-
MapPrinterServlet
@Autowired public MapPrinterServlet(JobManager jobManager, List<ReportLoader> reportLoaders, MapPrinterFactory printerFactory, org.springframework.context.ApplicationContext context, ServletInfo servletInfo, MapPrinterFactory mapPrinterFactory, com.codahale.metrics.MetricRegistry metricRegistry)
-
-
Method Details
-
getStatusSpecificAppId
@RequestMapping(value="/{appId}/status/{referenceId:\\S+}.json", method=GET) public final void getStatusSpecificAppId(@Nonnull @PathVariable String appId, @Nonnull @PathVariable String referenceId, javax.servlet.http.HttpServletRequest statusRequest, javax.servlet.http.HttpServletResponse statusResponse) Get a status report on a job. Returns the following json:{"time":0,"count":0,"done":false}- Parameters:
appId- the app IDreferenceId- the job referencestatusRequest- the request objectstatusResponse- the response object
-
getStatusPath
@RequestMapping(value="/status/{referenceId:\\S+}.json", method=GET) public final void getStatusPath(@Nonnull @PathVariable String referenceId, javax.servlet.http.HttpServletRequest statusRequest, javax.servlet.http.HttpServletResponse statusResponse) Get a status report on a job. Returns the following json:{"time":0,"count":0,"done":false}- Parameters:
referenceId- the job referencestatusRequest- the request objectstatusResponse- the response object
-
cancelSpecificAppId
@RequestMapping(value="/{appId}/cancel/{referenceId:\\S+}", method=DELETE) public final void cancelSpecificAppId(@Nonnull @PathVariable String appId, @Nonnull @PathVariable String referenceId, javax.servlet.http.HttpServletResponse statusResponse) Cancel a job.Even if a job was already finished, subsequent status requests will return that the job was canceled.
- Parameters:
appId- the app IDreferenceId- the job referencestatusResponse- the response object
-
cancelPath
@RequestMapping(value="/cancel/{referenceId:\\S+}", method=DELETE) public final void cancelPath(@Nonnull @PathVariable String referenceId, javax.servlet.http.HttpServletResponse statusResponse) Cancel a job.Even if a job was already finished, subsequent status requests will return that the job was canceled.
- Parameters:
referenceId- the job referencestatusResponse- the response object
-
createReport
@RequestMapping(value="/{appId}/report.{format:\\w+}", method=POST) public final void createReport(@Nonnull @PathVariable String appId, @PathVariable String format, @RequestBody String requestData, javax.servlet.http.HttpServletRequest createReportRequest, javax.servlet.http.HttpServletResponse createReportResponse) throws NoSuchAppException Add the print job to the job queue.- Parameters:
appId- the id of the app to get the request for.format- the format of the returned reportrequestData- a json formatted string with the request data required to perform the report generation.createReportRequest- the request objectcreateReportResponse- the response object- Throws:
NoSuchAppException
-
getReportSpecificAppId
@RequestMapping(value="/{appId}/report/{referenceId:\\S+}", method=GET) public final void getReportSpecificAppId(@Nonnull @PathVariable String appId, @Nonnull @PathVariable String referenceId, @RequestParam(value="inline",defaultValue="false") boolean inline, javax.servlet.http.HttpServletResponse getReportResponse) throws IOException, javax.servlet.ServletException To get the PDF created previously.- Parameters:
appId- the app IDreferenceId- the path to the file.inline- whether to inline thegetReportResponse- the response object- Throws:
IOExceptionjavax.servlet.ServletException
-
getReportPath
@RequestMapping(value="/report/{referenceId:\\S+}", method=GET) public final void getReportPath(@Nonnull @PathVariable String referenceId, @RequestParam(value="inline",defaultValue="false") boolean inline, javax.servlet.http.HttpServletResponse getReportResponse) throws IOException, javax.servlet.ServletException To get the PDF created previously.- Parameters:
referenceId- the job referenceinline- whether to inline thegetReportResponse- the response object- Throws:
IOExceptionjavax.servlet.ServletException
-
createReport
@RequestMapping(value="/report.{format:\\w+}", method=POST) public final void createReport(@PathVariable String format, @RequestBody String requestData, javax.servlet.http.HttpServletRequest createReportRequest, javax.servlet.http.HttpServletResponse createReportResponse) throws NoSuchAppException Add the print job to the job queue.- Parameters:
format- the format of the returned reportrequestData- a json formatted string with the request data required to perform the report generation.createReportRequest- the request objectcreateReportResponse- the response object- Throws:
NoSuchAppException
-
createReportAndGet
@RequestMapping(value="/{appId}/buildreport.{format:\\w+}", method=POST) public final void createReportAndGet(@Nonnull @PathVariable String appId, @PathVariable String format, @RequestBody String requestData, @RequestParam(value="inline",defaultValue="false") boolean inline, javax.servlet.http.HttpServletRequest createReportRequest, javax.servlet.http.HttpServletResponse createReportResponse) throws IOException, javax.servlet.ServletException, InterruptedException, NoSuchAppException add the print job to the job queue.- Parameters:
appId- the id of the app to get the request for.format- the format of the returned reportrequestData- a json formatted string with the request data required to perform the report generation.inline- whether to inline the contentcreateReportRequest- the request objectcreateReportResponse- the response object- Throws:
IOExceptionjavax.servlet.ServletExceptionInterruptedExceptionNoSuchAppException
-
createReportAndGetNoAppId
@RequestMapping(value="/buildreport.{format:\\w+}", method=POST) public final void createReportAndGetNoAppId(@PathVariable String format, @RequestBody String requestData, @RequestParam(value="inline",defaultValue="false") boolean inline, javax.servlet.http.HttpServletRequest createReportRequest, javax.servlet.http.HttpServletResponse createReportResponse) throws IOException, javax.servlet.ServletException, InterruptedException, NoSuchAppException add the print job to the job queue.- Parameters:
format- the format of the returned reportrequestData- a json formatted string with the request data required to perform the report generation.inline- whether to inline the contentcreateReportRequest- the request objectcreateReportResponse- the response object- Throws:
IOExceptionjavax.servlet.ServletExceptionInterruptedExceptionNoSuchAppException
-
listAppIds
@RequestMapping(value="/apps.json", method=GET) public final void listAppIds(javax.servlet.http.HttpServletResponse listAppsResponse) throws javax.servlet.ServletException, IOException To get (in JSON) the information about the available formats and CO.- Parameters:
listAppsResponse- the response object- Throws:
javax.servlet.ServletExceptionIOException
-
getCapabilities
@RequestMapping(value="/capabilities.json", method=GET) public final void getCapabilities(@RequestParam(value="pretty",defaultValue="false") boolean pretty, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse capabilitiesResponse) throws javax.servlet.ServletException, IOException To get (in JSON) the information about the available formats and CO.- Parameters:
pretty- if true then pretty print the capabilitiesrequest- the requestcapabilitiesResponse- the response object- Throws:
javax.servlet.ServletExceptionIOException
-
getCapabilities
@RequestMapping(value="/{appId}/capabilities.json", method=GET) public final void getCapabilities(@Nonnull @PathVariable String appId, @RequestParam(value="pretty",defaultValue="false") boolean pretty, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse capabilitiesResponse) throws javax.servlet.ServletException, IOException To get (in JSON) the information about the available formats and CO.- Parameters:
appId- the name of the "app" or in other words, a mapping to the configuration file for this request.pretty- if true then pretty print the capabilitiesrequest- the requestcapabilitiesResponse- the response object- Throws:
javax.servlet.ServletExceptionIOException
-
getExampleRequest
@RequestMapping(value="/exampleRequest.json", method=GET) public final void getExampleRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse getExampleResponse) throws IOException Get a sample request for the app. An empty response may be returned if there is not example request.- Parameters:
request- the request objectgetExampleResponse- the response object- Throws:
IOException
-
getExampleRequest
@RequestMapping(value="{appId}/exampleRequest.json", method=GET) public final void getExampleRequest(@Nonnull @PathVariable String appId, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse getExampleResponse) throws IOException Get a sample request for the app. An empty response may be returned if there is not example request.- Parameters:
appId- the id of the app to get the request for.request- the request objectgetExampleResponse- the response object- Throws:
IOException
-
listAvailableFonts
@RequestMapping("/fonts") public final void listAvailableFonts(javax.servlet.http.HttpServletResponse response) List the available fonts on the system.- Parameters:
response- the response object
-
setMaxCreateAndGetWaitTimeInSeconds
public final void setMaxCreateAndGetWaitTimeInSeconds(long maxCreateAndGetWaitTimeInSeconds) Maximum time to wait for a createAndGet request to complete before returning an error.- Parameters:
maxCreateAndGetWaitTimeInSeconds- the maximum time in seconds to wait for a report to be generated.
-
getHeaders
protected final org.json.JSONObject getHeaders(javax.servlet.http.HttpServletRequest httpServletRequest) Read the headers from the request.- Parameters:
httpServletRequest- the request object
-