Class 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:
    Serialized Form
    • Field Detail

      • 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
    • Constructor Detail

      • PDFGenerator

        public PDFGenerator()
    • Method Detail

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