Package digilib.conf
Class DigilibRequest
java.lang.Object
digilib.util.ParameterMap
digilib.conf.DigilibRequest
- Direct Known Subclasses:
DigilibServletRequest
Class holding the parameters of a digilib user request. The parameters are
mostly named like the servlet parameters:
request.path: url of the page/document.
fn: url of the page/document.
pn: page number.
dw: width of result window in pixels.
dh: height of result window in pixels.
wx: left edge of image area (float from 0 to 1).
wy: top edge of image area (float from 0 to 1).
ww: width of image area(float from 0 to 1).
wh: height of image area(float from 0 to 1).
ws: scale factor.
mo: special options like 'fit'.
...et cetera
request.path: url of the page/document.
fn: url of the page/document.
pn: page number.
dw: width of result window in pixels.
dh: height of result window in pixels.
wx: left edge of image area (float from 0 to 1).
wy: top edge of image area (float from 0 to 1).
ww: width of image area(float from 0 to 1).
wh: height of image area(float from 0 to 1).
ws: scale factor.
mo: special options like 'fit'.
...et cetera
- Author:
- casties
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
special options for parsing the request. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DigilibConfiguration
DigilibConfiguration for this requesterror message while configuringIIIF image API versionIIIF path prefix (taken from config)protected String
IIIF slash replacement (taken from config)boolean
parse IIIF path as IIIF image APIactive pasing optionsprotected ImageJobDescription
ImageJobDescription for this requestFields inherited from class digilib.util.ParameterMap
options, params
-
Constructor Summary
ConstructorsConstructorDescriptionDigilibRequest
(DigilibConfiguration config) Create DigilibRequest with DigilibConfiguration.DigilibRequest
(DigilibConfiguration config, ParameterMap params) Create DigilibRequest with DigilibConfiguration with added ParameterMap. -
Method Summary
Modifier and TypeMethodDescriptiondecodeIiifIdentifier
(String identifier) Decodes the IIIF identifier part into a digilib path.encodeIiifIdentifier
(String path) Encodes a digilib path into an IIIF identifier partReturn the request parameters as a String in the parameter form 'fn=/icons&pn=1'.getAsString
(int type) Return the request parameters of a given type type as a String in the parameter form 'fn=/icons&pn=1'.The image file path to be accessed.boolean
Deprecated.protected void
set up optionsprotected void
Define and set up parameters with default values.void
setDigilibConfig
(DigilibConfiguration config) void
setJobDescription
(ImageJobDescription ticket) boolean
setWithIiifImageParams
(String identifier, String region, String size, String rotation, String quality, String format) Populate a request from IIIF image API parameters.boolean
setWithIiifPath
(String path) Populate a request from a string with an IIIF image API path.void
setWithParamString
(String qs, String sep) Set request parameters from query string.Methods inherited from class digilib.util.ParameterMap
cloneInstance, get, getAsBoolean, getAsFile, getAsFloat, getAsInt, getAsString, getInstance, getOptions, getParameters, getParams, getValue, hasOption, hasValue, newParameter, newParameter, put, put, setOptions, setParams, setValue, setValue, setValue, setValueFromString
-
Field Details
-
parsingOptions
active pasing options -
iiifPrefix
IIIF path prefix (taken from config) -
iiifSlashReplacement
IIIF slash replacement (taken from config) -
iiifApiVersion
IIIF image API version -
parseIiifImageApi
public boolean parseIiifImageApiparse IIIF path as IIIF image API -
errorMessage
error message while configuring -
ticket
ImageJobDescription for this request -
config
DigilibConfiguration for this request
-
-
Constructor Details
-
DigilibRequest
public DigilibRequest() -
DigilibRequest
Create DigilibRequest with DigilibConfiguration.- Parameters:
config
- the DigilibConfiguration
-
DigilibRequest
Create DigilibRequest with DigilibConfiguration with added ParameterMap.- Parameters:
config
- the DigilibConfigurationparams
- ParameterMap to add
-
-
Method Details
-
initParams
protected void initParams()Define and set up parameters with default values.- Overrides:
initParams
in classParameterMap
-
initOptions
protected void initOptions()Description copied from class:ParameterMap
set up options- Overrides:
initOptions
in classParameterMap
-
getAsString
Return the request parameters as a String in the parameter form 'fn=/icons&pn=1'. Empty (undefined) fields are not included.- Returns:
- String of request parameters in parameter form.
-
getAsString
Return the request parameters of a given type type as a String in the parameter form 'fn=/icons&pn=1'. Empty (undefined) fields are not included.- Parameters:
type
- the type- Returns:
- String of request parameters in parameter form.
-
setWithParamString
Set request parameters from query string. Uses the separator string qs to get 'fn=foo' style parameters.- Parameters:
qs
- query stringsep
- parameter-separator string
-
setWithIiifPath
Populate a request from a string with an IIIF image API path. path should be non-URL-decoded and have no leading slash. URI template: {scheme}://{server}{/prefix}/{identifier}/{region}/{size}/{rotation}/{quality}.{format}- Parameters:
path
- String with IIIF Image API path.- Returns:
- true of successful
- See Also:
-
setWithIiifImageParams
public boolean setWithIiifImageParams(String identifier, String region, String size, String rotation, String quality, String format) Populate a request from IIIF image API parameters.- Parameters:
identifier
- the identifierregion
- the regionsize
- the sizerotation
- the rotationquality
- the qualityformat
- the format- Returns:
- true if successful
- See Also:
-
decodeIiifIdentifier
Decodes the IIIF identifier part into a digilib path.- Parameters:
identifier
- the identifier- Returns:
- the path
- Throws:
UnsupportedEncodingException
- on error
-
encodeIiifIdentifier
Encodes a digilib path into an IIIF identifier part- Parameters:
path
- the path- Returns:
- the identifier
- Throws:
UnsupportedEncodingException
- on error
-
hasOption
Deprecated.useParameterMap.hasOption(DigilibOption)
for "mo"-options.Test if option stringopt
is set. Checks if the substringopt
is contained in the options stringparam
.- Parameters:
param
- the paramopt
- Option string to be tested.- Returns:
- if option is set
-
getFilePath
The image file path to be accessed. The image file path is assembled from the servlets RequestPath and Parameter fn and normalized.- Returns:
- the effective filepath.
-
getJobDescription
- Returns:
- the ticket
-
setJobDescription
- Parameters:
ticket
- the ticket to set
-
getDigilibConfig
- Returns:
- the config
-
setDigilibConfig
- Parameters:
config
- the config to set
-
ParameterMap.hasOption(DigilibOption)
for "mo"-options.