Package digilib.servlet
Class Manifester
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- digilib.servlet.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
Manifester.ManifestParams
Class holding parameters to construct manifest.
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
accountlog
logger for accounting requestsprotected AuthzOps
authzOp
AuthOps instanceprotected boolean
corsForInfoRequests
set CORS header ACAO* for info requestsprotected DocuDirCache
dirCache
DocuDirCache instanceprotected DigilibServletConfiguration
dlConfig
DigilibConfiguration instanceprotected String
iiifPathSep
character for IIIF path separationprotected org.slf4j.Logger
logger
general loggerstatic String
mfVersion
Servlet versionprotected String
pageLabelMode
how to create label for pagesprotected String
scalerServletPath
scaler servlet pathprotected boolean
useAuthorization
use authentication and authorizationprotected boolean
useFilesystem
use filesystem-access to read additional json files
-
Constructor Summary
Constructors Constructor Description Manifester()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
copyToManifest(String key, jakarta.json.JsonValue value, jakarta.json.stream.JsonGenerator manifest)
Write JSON object value recursively under key into JsonGenerator manifest.protected void
doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
protected void
doOptions(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
long
getLastModified(javax.servlet.http.HttpServletRequest request)
Returns modification time relevant to the request for caching.void
init(javax.servlet.ServletConfig config)
protected void
processRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
protected void
writeCanvas(jakarta.json.stream.JsonGenerator manifest, int idx, DocuDirent imgFile, ImageSize imgSize, Manifester.ManifestParams params)
protected void
writeCanvases(jakarta.json.stream.JsonGenerator manifest, Manifester.ManifestParams params)
protected void
writeImagesV2(jakarta.json.stream.JsonGenerator manifest, int idx, DocuDirent imgFile, ImageSize imgSize, Manifester.ManifestParams params)
protected void
writeImagesV3(jakarta.json.stream.JsonGenerator manifest, int idx, DocuDirent imgFile, ImageSize imgSize, Manifester.ManifestParams params)
protected void
writeImageV2(jakarta.json.stream.JsonGenerator manifest, int idx, DocuDirent imgFile, ImageSize imgSize, Manifester.ManifestParams params)
protected void
writeImageV3(jakarta.json.stream.JsonGenerator manifest, int idx, DocuDirent imgFile, ImageSize imgSize, Manifester.ManifestParams params)
protected void
writeLangLabel(jakarta.json.stream.JsonGenerator manifest, String key, String lang, String label)
Write a label with the given language under key.protected void
writeManifestMetaV2(jakarta.json.stream.JsonGenerator manifest, String dlFn, Manifester.ManifestParams params)
protected void
writeManifestMetaV3(jakarta.json.stream.JsonGenerator manifest, String dlFn, Manifester.ManifestParams params)
protected void
writeResource(jakarta.json.stream.JsonGenerator manifest, DocuDirent imgFile, ImageSize imgSize, Manifester.ManifestParams params)
protected void
writeSequencesV2(jakarta.json.stream.JsonGenerator manifest, Manifester.ManifestParams params)
protected void
writeSequenceV2(jakarta.json.stream.JsonGenerator manifest, Manifester.ManifestParams params)
protected void
writeServiceV2(jakarta.json.stream.JsonGenerator manifest, String iiifImgBaseUrl, ImageSize imgSize, Manifester.ManifestParams params)
protected void
writeServiceV3(jakarta.json.stream.JsonGenerator manifest, String iiifImgBaseUrl, ImageSize imgSize, Manifester.ManifestParams params)
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doPost, doPut, doTrace, service, service
-
-
-
-
Field Detail
-
mfVersion
public static String mfVersion
Servlet version
-
dlConfig
protected DigilibServletConfiguration dlConfig
DigilibConfiguration instance
-
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
-
-
Method Detail
-
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
-
getLastModified
public long getLastModified(javax.servlet.http.HttpServletRequest request)
Returns modification time relevant to the request for caching.- Overrides:
getLastModified
in classjavax.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 classjavax.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 classjavax.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 JsonGeneratordlFn
- the fnparams
- the ManifestParams
-
writeManifestMetaV3
protected void writeManifestMetaV3(jakarta.json.stream.JsonGenerator manifest, String dlFn, Manifester.ManifestParams params)
- Parameters:
manifest
- the JsonGeneratordlFn
- the fnparams
- the ManifestParams
-
writeSequencesV2
protected void writeSequencesV2(jakarta.json.stream.JsonGenerator manifest, Manifester.ManifestParams params)
- Parameters:
manifest
- the JsonGeneratorparams
- the ManifestParams
-
writeSequenceV2
protected void writeSequenceV2(jakarta.json.stream.JsonGenerator manifest, Manifester.ManifestParams params)
- Parameters:
manifest
- the JsonGeneratorparams
- the ManifestParams
-
writeCanvases
protected void writeCanvases(jakarta.json.stream.JsonGenerator manifest, Manifester.ManifestParams params)
- Parameters:
manifest
- the JsonGeneratorparams
- the ManifestParams
-
writeCanvas
protected void writeCanvas(jakarta.json.stream.JsonGenerator manifest, int idx, DocuDirent imgFile, ImageSize imgSize, Manifester.ManifestParams params)
- Parameters:
manifest
- the JsonGeneratoridx
- the idximgFile
- the DocuDirentimgSize
- the ImageSizeparams
- the ManifestParams
-
writeImagesV2
protected void writeImagesV2(jakarta.json.stream.JsonGenerator manifest, int idx, DocuDirent imgFile, ImageSize imgSize, Manifester.ManifestParams params)
- Parameters:
manifest
- the JsonGeneratoridx
- the idximgFile
- the DocuDirentimgSize
- the ImageSizeparams
- the ManifestParams
-
writeImagesV3
protected void writeImagesV3(jakarta.json.stream.JsonGenerator manifest, int idx, DocuDirent imgFile, ImageSize imgSize, Manifester.ManifestParams params)
- Parameters:
manifest
- the JsonGeneratoridx
- the idximgFile
- the DocuDirentimgSize
- the ImageSizeparams
- the ManifestParams
-
writeImageV2
protected void writeImageV2(jakarta.json.stream.JsonGenerator manifest, int idx, DocuDirent imgFile, ImageSize imgSize, Manifester.ManifestParams params)
- Parameters:
manifest
- the JsonGeneratoridx
- the idximgFile
- the DocuDirentimgSize
- the ImageSizeparams
- the ManifestParams
-
writeImageV3
protected void writeImageV3(jakarta.json.stream.JsonGenerator manifest, int idx, DocuDirent imgFile, ImageSize imgSize, Manifester.ManifestParams params)
- Parameters:
manifest
- the JsonGeneratoridx
- the idximgFile
- the DocuDirentimgSize
- the ImageSizeparams
- the ManifestParams
-
writeResource
protected void writeResource(jakarta.json.stream.JsonGenerator manifest, DocuDirent imgFile, ImageSize imgSize, Manifester.ManifestParams params)
- Parameters:
manifest
- the JsonGeneratorimgFile
- the DocuDirentimgSize
- the ImageSizeparams
- the ManifestParams
-
writeServiceV2
protected void writeServiceV2(jakarta.json.stream.JsonGenerator manifest, String iiifImgBaseUrl, ImageSize imgSize, Manifester.ManifestParams params)
- Parameters:
manifest
- the JsonGeneratoriiifImgBaseUrl
- the iiifImgBaseUrlimgSize
- the ImageSizeparams
- the ManifestParams
-
writeServiceV3
protected void writeServiceV3(jakarta.json.stream.JsonGenerator manifest, String iiifImgBaseUrl, ImageSize imgSize, Manifester.ManifestParams params)
- Parameters:
manifest
- the JsonGeneratoriiifImgBaseUrl
- the iiifImgBaseUrlimgSize
- the ImageSizeparams
- 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 keyvalue
- the JsonValuemanifest
- the JsonGenerator
-
-