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 Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static org.slf4j.Logger
logger for accounting requestsprotected static org.slf4j.Logger
logger for authentication relatedstatic final String
static final String
static final String
protected static org.slf4j.Logger
gengeral logger for this classstatic String
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateNewPdfDocument
(PDFRequest pdfji, String filename) create new thread for pdf generation.decodeDocid
(String encid) void
doGet
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) void
doPost
(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.void
init
(javax.servlet.ServletConfig config) 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.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
-
Field Details
-
version
-
accountlog
protected static org.slf4j.Logger accountloglogger for accounting requests -
logger
protected static org.slf4j.Logger loggergengeral logger for this class -
authlog
protected 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
-
PDFGenerator
public PDFGenerator()
-
-
Method Details
-
init
public void init(javax.servlet.ServletConfig config) throws javax.servlet.ServletException - Specified by:
init
in interfacejavax.servlet.Servlet
- Overrides:
init
in classjavax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
-
doGet
public void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException - Overrides:
doGet
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
-
doPost
public void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException - Overrides:
doPost
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
-
notifyUser
public 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
-
-
getStatus
check the status of the document corresponding to the documentid -
createNewPdfDocument
public Future<File> createNewPdfDocument(PDFRequest pdfji, String filename) throws FileNotFoundException create new thread for pdf generation.- Parameters:
pdfji
-filename
-- Returns:
- Throws:
FileNotFoundException
-
getDownloadFilename
generate the filename the user is going to receive the pdf as- Parameters:
pdfji
-- Returns:
-
getDownloadFilename
generate the filename the user is going to receive the pdf as- Parameters:
docid
-- Returns:
-
getCacheDirectory
-
getTempDirectory
-
getTempFile
returns a File object based on filename in the temp directory.- Parameters:
filename
-- Returns:
-
getCacheFile
returns a File object based on filename in the cache directory.- Parameters:
filename
-- Returns:
-
encodeDocid
-
decodeDocid
-