Package digilib.servlet
Class PDFGenerator
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
digilib.servlet.PDFGenerator
- All Implemented Interfaces:
- Serializable,- javax.servlet.Servlet,- javax.servlet.ServletConfig
@WebServlet(name="PDFGenerator",
            urlPatterns={"/PDFGenerator/*","/PDFCache/*","/servlet/PDFCache/*"})
public class PDFGenerator
extends javax.servlet.http.HttpServlet
A class for handling user requests for pdf documents made from digilib
 images.
 
 If a document does not already exist, it will be enqueued for generation; if
 it does exist, it is sent to the user.
- Author:
- cmielack, casties
- See Also:
- 
Nested Class SummaryNested Classes
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static org.slf4j.Loggerlogger for accounting requestsprotected static org.slf4j.Loggerlogger for authentication relatedstatic final Stringstatic final Stringstatic final Stringprotected static org.slf4j.Loggergengeral logger for this classstatic Stringstatic final String
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncreateNewPdfDocument(PDFRequest pdfji, String filename) create new thread for pdf generation.decodeDocid(String encid) voiddoGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) voiddoPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) encodeDocid(String docid) getCacheFile(String filename) returns a File object based on filename in the cache directory.getDownloadFilename(PDFRequest pdfji) generate the filename the user is going to receive the pdf asgetDownloadFilename(String docid) generate the filename the user is going to receive the pdf ascheck the status of the document corresponding to the documentidgetTempFile(String filename) returns a File object based on filename in the temp directory.voidinit(javax.servlet.ServletConfig config) voidnotifyUser(PDFGenerator.PDFStatus status, String documentid, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) depending on the documents status, redirect the user to the appropriate waiting or download page.Methods inherited from class javax.servlet.http.HttpServletdoDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, serviceMethods inherited from class javax.servlet.GenericServletdestroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
- 
Field Details- 
version
- 
accountlogprotected static org.slf4j.Logger accountloglogger for accounting requests
- 
loggerprotected static org.slf4j.Logger loggergengeral logger for this class
- 
authlogprotected static org.slf4j.Logger authloglogger for authentication related
- 
INSTANCE_KEY- See Also:
 
- 
WIP_PAGE_KEY- See Also:
 
- 
ERROR_PAGE_KEY- See Also:
 
- 
IOERROR_PAGE_KEY- See Also:
 
 
- 
- 
Constructor Details- 
PDFGeneratorpublic PDFGenerator()
 
- 
- 
Method Details- 
initpublic void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException - Specified by:
- initin interface- javax.servlet.Servlet
- Overrides:
- initin class- javax.servlet.GenericServlet
- Throws:
- javax.servlet.ServletException
 
- 
doGetpublic void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException - Overrides:
- doGetin class- javax.servlet.http.HttpServlet
- Throws:
- javax.servlet.ServletException
 
- 
doPostpublic void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException - Overrides:
- doPostin class- javax.servlet.http.HttpServlet
- Throws:
- javax.servlet.ServletException
 
- 
notifyUserpublic void notifyUser(PDFGenerator.PDFStatus status, String documentid, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) depending on the documents status, redirect the user to the appropriate waiting or download page.- Parameters:
- status-
- documentid-
- request-
- response-
 
- 
getStatuscheck the status of the document corresponding to the documentid
- 
createNewPdfDocumentpublic Future<File> createNewPdfDocument(PDFRequest pdfji, String filename) throws FileNotFoundException create new thread for pdf generation.- Parameters:
- pdfji-
- filename-
- Returns:
- Throws:
- FileNotFoundException
 
- 
getDownloadFilenamegenerate the filename the user is going to receive the pdf as- Parameters:
- pdfji-
- Returns:
 
- 
getDownloadFilenamegenerate the filename the user is going to receive the pdf as- Parameters:
- docid-
- Returns:
 
- 
getCacheDirectory
- 
getTempDirectory
- 
getTempFilereturns a File object based on filename in the temp directory.- Parameters:
- filename-
- Returns:
 
- 
getCacheFilereturns a File object based on filename in the cache directory.- Parameters:
- filename-
- Returns:
 
- 
encodeDocid
- 
decodeDocid
 
-