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:
  • Field Details

    • version

      public static String version
    • accountlog

      protected static org.slf4j.Logger accountlog
      logger for accounting requests
    • logger

      protected static org.slf4j.Logger logger
      gengeral logger for this class
    • authlog

      protected static org.slf4j.Logger authlog
      logger for authentication related
    • INSTANCE_KEY

      public static final String INSTANCE_KEY
      See Also:
    • WIP_PAGE_KEY

      public static final String WIP_PAGE_KEY
      See Also:
    • ERROR_PAGE_KEY

      public static final String ERROR_PAGE_KEY
      See Also:
    • IOERROR_PAGE_KEY

      public static final String 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 interface javax.servlet.Servlet
      Overrides:
      init in class javax.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 class javax.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 class javax.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

      public PDFGenerator.PDFStatus getStatus(String documentid)
      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

      public String getDownloadFilename(PDFRequest pdfji)
      generate the filename the user is going to receive the pdf as
      Parameters:
      pdfji -
      Returns:
    • getDownloadFilename

      public String getDownloadFilename(String docid)
      generate the filename the user is going to receive the pdf as
      Parameters:
      docid -
      Returns:
    • getCacheDirectory

      public File getCacheDirectory()
    • getTempDirectory

      public File getTempDirectory()
    • getTempFile

      public File getTempFile(String filename)
      returns a File object based on filename in the temp directory.
      Parameters:
      filename -
      Returns:
    • getCacheFile

      public File getCacheFile(String filename)
      returns a File object based on filename in the cache directory.
      Parameters:
      filename -
      Returns:
    • encodeDocid

      public String encodeDocid(String docid)
    • decodeDocid

      public String decodeDocid(String encid)