Class Manifester

  • All Implemented Interfaces:
    Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    @WebServlet(name="Manifester",
                urlPatterns={"/Manifester/*","/servlet/Manifester/*"})
    public class Manifester
    extends javax.servlet.http.HttpServlet
    Servlet for creating IIIF Presentation API manifests. Reads file manifest.json to replace the automatically generated output. Reads file manifest-meta.json and merges the content into the top-level of the generated manifest.
    Author:
    casties
    See Also:
    Serialized Form
    • Field Detail

      • mfVersion

        public static String mfVersion
        Servlet version
      • logger

        protected org.slf4j.Logger logger
        general logger
      • accountlog

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

        protected AuthzOps authzOp
        AuthOps instance
      • dirCache

        protected DocuDirCache dirCache
        DocuDirCache instance
      • useAuthorization

        protected boolean useAuthorization
        use authentication and authorization
      • scalerServletPath

        protected String scalerServletPath
        scaler servlet path
      • iiifPathSep

        protected String iiifPathSep
        character for IIIF path separation
      • corsForInfoRequests

        protected boolean corsForInfoRequests
        set CORS header ACAO* for info requests
      • pageLabelMode

        protected String pageLabelMode
        how to create label for pages
      • useFilesystem

        protected boolean useFilesystem
        use filesystem-access to read additional json files
    • Constructor Detail

      • Manifester

        public Manifester()
    • 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
      • getLastModified

        public long getLastModified​(javax.servlet.http.HttpServletRequest request)
        Returns modification time relevant to the request for caching.
        Overrides:
        getLastModified in class javax.servlet.http.HttpServlet
        See Also:
        HttpServlet.getLastModified(javax.servlet.http.HttpServletRequest)
      • doGet

        protected void doGet​(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws javax.servlet.ServletException,
                             IOException
        Overrides:
        doGet in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • doOptions

        protected void doOptions​(javax.servlet.http.HttpServletRequest req,
                                 javax.servlet.http.HttpServletResponse resp)
                          throws javax.servlet.ServletException,
                                 IOException
        Overrides:
        doOptions in class javax.servlet.http.HttpServlet
        Throws:
        javax.servlet.ServletException
        IOException
      • processRequest

        protected void processRequest​(javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response)
      • writeManifestMetaV2

        protected void writeManifestMetaV2​(jakarta.json.stream.JsonGenerator manifest,
                                           String dlFn,
                                           Manifester.ManifestParams params)
        Parameters:
        manifest - the JsonGenerator
        dlFn - the fn
        params - the ManifestParams
      • writeManifestMetaV3

        protected void writeManifestMetaV3​(jakarta.json.stream.JsonGenerator manifest,
                                           String dlFn,
                                           Manifester.ManifestParams params)
        Parameters:
        manifest - the JsonGenerator
        dlFn - the fn
        params - the ManifestParams
      • writeSequencesV2

        protected void writeSequencesV2​(jakarta.json.stream.JsonGenerator manifest,
                                        Manifester.ManifestParams params)
        Parameters:
        manifest - the JsonGenerator
        params - the ManifestParams
      • writeSequenceV2

        protected void writeSequenceV2​(jakarta.json.stream.JsonGenerator manifest,
                                       Manifester.ManifestParams params)
        Parameters:
        manifest - the JsonGenerator
        params - the ManifestParams
      • writeCanvases

        protected void writeCanvases​(jakarta.json.stream.JsonGenerator manifest,
                                     Manifester.ManifestParams params)
        Parameters:
        manifest - the JsonGenerator
        params - the ManifestParams
      • writeCanvas

        protected void writeCanvas​(jakarta.json.stream.JsonGenerator manifest,
                                   int idx,
                                   DocuDirent imgFile,
                                   ImageSize imgSize,
                                   Manifester.ManifestParams params)
        Parameters:
        manifest - the JsonGenerator
        idx - the idx
        imgFile - the DocuDirent
        imgSize - the ImageSize
        params - the ManifestParams
      • writeImagesV2

        protected void writeImagesV2​(jakarta.json.stream.JsonGenerator manifest,
                                     int idx,
                                     DocuDirent imgFile,
                                     ImageSize imgSize,
                                     Manifester.ManifestParams params)
        Parameters:
        manifest - the JsonGenerator
        idx - the idx
        imgFile - the DocuDirent
        imgSize - the ImageSize
        params - the ManifestParams
      • writeImagesV3

        protected void writeImagesV3​(jakarta.json.stream.JsonGenerator manifest,
                                     int idx,
                                     DocuDirent imgFile,
                                     ImageSize imgSize,
                                     Manifester.ManifestParams params)
        Parameters:
        manifest - the JsonGenerator
        idx - the idx
        imgFile - the DocuDirent
        imgSize - the ImageSize
        params - the ManifestParams
      • writeImageV2

        protected void writeImageV2​(jakarta.json.stream.JsonGenerator manifest,
                                    int idx,
                                    DocuDirent imgFile,
                                    ImageSize imgSize,
                                    Manifester.ManifestParams params)
        Parameters:
        manifest - the JsonGenerator
        idx - the idx
        imgFile - the DocuDirent
        imgSize - the ImageSize
        params - the ManifestParams
      • writeImageV3

        protected void writeImageV3​(jakarta.json.stream.JsonGenerator manifest,
                                    int idx,
                                    DocuDirent imgFile,
                                    ImageSize imgSize,
                                    Manifester.ManifestParams params)
        Parameters:
        manifest - the JsonGenerator
        idx - the idx
        imgFile - the DocuDirent
        imgSize - the ImageSize
        params - the ManifestParams
      • writeResource

        protected void writeResource​(jakarta.json.stream.JsonGenerator manifest,
                                     DocuDirent imgFile,
                                     ImageSize imgSize,
                                     Manifester.ManifestParams params)
        Parameters:
        manifest - the JsonGenerator
        imgFile - the DocuDirent
        imgSize - the ImageSize
        params - the ManifestParams
      • writeServiceV2

        protected void writeServiceV2​(jakarta.json.stream.JsonGenerator manifest,
                                      String iiifImgBaseUrl,
                                      ImageSize imgSize,
                                      Manifester.ManifestParams params)
        Parameters:
        manifest - the JsonGenerator
        iiifImgBaseUrl - the iiifImgBaseUrl
        imgSize - the ImageSize
        params - the ManifestParams
      • writeServiceV3

        protected void writeServiceV3​(jakarta.json.stream.JsonGenerator manifest,
                                      String iiifImgBaseUrl,
                                      ImageSize imgSize,
                                      Manifester.ManifestParams params)
        Parameters:
        manifest - the JsonGenerator
        iiifImgBaseUrl - the iiifImgBaseUrl
        imgSize - the ImageSize
        params - the ManifestParams
      • writeLangLabel

        protected void writeLangLabel​(jakarta.json.stream.JsonGenerator manifest,
                                      String key,
                                      String lang,
                                      String label)
        Write a label with the given language under key.
        Parameters:
        manifest -
        key -
        lang -
        label -
      • copyToManifest

        protected void copyToManifest​(String key,
                                      jakarta.json.JsonValue value,
                                      jakarta.json.stream.JsonGenerator manifest)
        Write JSON object value recursively under key into JsonGenerator manifest.
        Parameters:
        key - the key
        value - the JsonValue
        manifest - the JsonGenerator