public class MapPrinterServlet extends BaseMapServlet
| Modifier and Type | Field and Description |
|---|---|
static org.apache.log4j.Logger |
SPEC_LOGGER |
protected static java.lang.String |
TEMP_FILE_PREFIX |
LOGGER| Constructor and Description |
|---|
MapPrinterServlet() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addTempFile(org.mapfish.print.servlet.MapPrinterServlet.TempFile tempFile,
java.lang.String id) |
protected void |
createAndGetPDF(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
All in one method: create and returns the PDF to the client.
|
protected void |
createPDF(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse,
java.lang.String basePath)
Create the PDF and returns to the client (in JSON) the URL to get the PDF.
|
protected void |
deleteFile(java.io.File file)
If the file is defined, delete it.
|
void |
destroy() |
protected org.mapfish.print.servlet.MapPrinterServlet.TempFile |
doCreatePDFFile(java.lang.String spec,
javax.servlet.http.HttpServletRequest httpServletRequest)
Do the actual work of creating the PDF temporary file.
|
protected void |
doGet(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse) |
protected void |
doPost(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse) |
protected void |
error(javax.servlet.http.HttpServletResponse httpServletResponse,
java.lang.String message,
int code)
Send an error XXX to the client with a message
|
protected void |
error(javax.servlet.http.HttpServletResponse httpServletResponse,
java.lang.Throwable e)
Send an error XXX to the client with an exception
|
protected java.lang.String |
generateId(java.io.File tempFile)
Get the ID to use in function of the filename (filename without the prefix and the extension).
|
protected java.lang.String |
getBaseUrl(javax.servlet.http.HttpServletRequest httpServletRequest) |
protected java.lang.String |
getEncoding()
Get and cache the used Encoding.
|
protected void |
getFile(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse httpServletResponse,
java.lang.String id)
To get the PDF created previously.
|
protected void |
getInfo(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
java.lang.String basePath)
To get (in JSON) the information about the available formats and CO.
|
protected java.lang.String |
getSpecFromPostBody(javax.servlet.http.HttpServletRequest httpServletRequest) |
protected java.io.File |
getTempDir()
Get and cache the temporary directory to use for saving the generated PDF files.
|
void |
init() |
protected void |
purgeOldTemporaryFiles()
Will purge all the known temporary files older than TEMP_FILE_PURGE_SECONDS.
|
protected void |
sendPdfFile(javax.servlet.http.HttpServletResponse httpServletResponse,
org.mapfish.print.servlet.MapPrinterServlet.TempFile tempFile,
boolean inline)
copy the PDF into the output stream
|
getMapPrinterdoDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, servicepublic static final org.apache.log4j.Logger SPEC_LOGGER
protected static final java.lang.String TEMP_FILE_PREFIX
protected void doGet(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
throws javax.servlet.ServletException,
java.io.IOException
doGet in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionjava.io.IOExceptionprotected void doPost(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
throws javax.servlet.ServletException,
java.io.IOException
doPost in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionjava.io.IOExceptionpublic void init()
throws javax.servlet.ServletException
init in class javax.servlet.GenericServletjavax.servlet.ServletExceptionpublic void destroy()
destroy in interface javax.servlet.Servletdestroy in class javax.servlet.GenericServletprotected void createAndGetPDF(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
protected void createPDF(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse,
java.lang.String basePath)
throws javax.servlet.ServletException
javax.servlet.ServletExceptionprotected void addTempFile(org.mapfish.print.servlet.MapPrinterServlet.TempFile tempFile,
java.lang.String id)
protected java.lang.String getSpecFromPostBody(javax.servlet.http.HttpServletRequest httpServletRequest)
throws java.io.IOException
java.io.IOExceptionprotected java.lang.String getEncoding()
protected void getFile(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse httpServletResponse,
java.lang.String id)
throws java.io.IOException,
javax.servlet.ServletException
java.io.IOExceptionjavax.servlet.ServletExceptionprotected void getInfo(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
java.lang.String basePath)
throws javax.servlet.ServletException,
java.io.IOException
javax.servlet.ServletExceptionjava.io.IOExceptionprotected org.mapfish.print.servlet.MapPrinterServlet.TempFile doCreatePDFFile(java.lang.String spec,
javax.servlet.http.HttpServletRequest httpServletRequest)
throws java.io.IOException,
com.itextpdf.text.DocumentException,
javax.servlet.ServletException,
java.lang.InterruptedException
java.lang.InterruptedExceptionjava.io.IOExceptioncom.itextpdf.text.DocumentExceptionjavax.servlet.ServletExceptionprotected void sendPdfFile(javax.servlet.http.HttpServletResponse httpServletResponse,
org.mapfish.print.servlet.MapPrinterServlet.TempFile tempFile,
boolean inline)
throws java.io.IOException,
javax.servlet.ServletException
java.io.IOExceptionjavax.servlet.ServletExceptionprotected void error(javax.servlet.http.HttpServletResponse httpServletResponse,
java.lang.Throwable e)
protected void error(javax.servlet.http.HttpServletResponse httpServletResponse,
java.lang.String message,
int code)
protected java.io.File getTempDir()
protected void deleteFile(java.io.File file)
protected java.lang.String generateId(java.io.File tempFile)
protected java.lang.String getBaseUrl(javax.servlet.http.HttpServletRequest httpServletRequest)
protected void purgeOldTemporaryFiles()