Package digilib.conf
Class DigilibServletRequest
- java.lang.Object
-
- digilib.util.ParameterMap
-
- digilib.conf.DigilibRequest
-
- digilib.conf.DigilibServletRequest
-
public class DigilibServletRequest extends DigilibRequest
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' for gifs.
mk: list of marks.
pt: total number of pages (generated by sevlet).
baseURL: base URL (from http:// to below /servlet).
...et al- Author:
- casties
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class digilib.conf.DigilibRequest
DigilibRequest.ParsingOption
-
-
Field Summary
Fields Modifier and Type Field Description protected DocuImage
image
internal DocuImage instance for this requestprotected javax.servlet.http.HttpServletRequest
servletRequest
internal ServletRequest-
Fields inherited from class digilib.conf.DigilibRequest
config, errorMessage, iiifApiVersion, iiifPrefix, iiifSlashReplacement, parseIiifImageApi, parsingOptions, ticket
-
Fields inherited from class digilib.util.ParameterMap
options, params
-
-
Constructor Summary
Constructors Constructor Description DigilibServletRequest(javax.servlet.http.HttpServletRequest request)
Creates a new instance of DigilibRequest with parameters from a ServletRequest.DigilibServletRequest(javax.servlet.http.HttpServletRequest request, DigilibConfiguration config)
Creates a new instance of DigilibRequest with parameters from a ServletRequest.DigilibServletRequest(javax.servlet.http.HttpServletRequest request, DigilibConfiguration config, EnumSet<DigilibRequest.ParsingOption> parsingOptions)
Creates a new instance of DigilibRequest with parameters from a ServletRequest.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAsOldString()
Returns request parameters in old '++++' form.String
getAsString()
Return the request parameters as a String in the parameter form 'fn=/icons&pn=1'.String
getAsString(int type)
Return the request parameters of a given type type as a String in the parameter form 'fn=/icons&pn=1'.DocuImage
getImage()
Returns the image.javax.servlet.http.HttpServletRequest
getServletRequest()
Returns the ServletRequest.protected void
initOptions()
set up optionsprotected void
initParams()
Define and set up parameters with default values.void
setBaseURL(javax.servlet.http.HttpServletRequest request)
Set the requests base URL parameter from a javax.sevlet.http.HttpServletRequest.void
setImage(DocuImage image)
Sets the image.void
setWithOldString(String queryString)
Populate a request from a string in the old "++++" parameter form.void
setWithParamRequest(javax.servlet.ServletRequest request)
Set request parameters from javax.servlet.ServletRequest.void
setWithRequest(javax.servlet.http.HttpServletRequest request)
Populate the request object with data from a ServletRequest.-
Methods inherited from class digilib.conf.DigilibRequest
decodeIiifIdentifier, encodeIiifIdentifier, getDigilibConfig, getFilePath, getJobDescription, hasOption, setDigilibConfig, setJobDescription, setWithIiifImageParams, setWithIiifPath, setWithParamString
-
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 Detail
-
image
protected DocuImage image
internal DocuImage instance for this request
-
servletRequest
protected javax.servlet.http.HttpServletRequest servletRequest
internal ServletRequest
-
-
Constructor Detail
-
DigilibServletRequest
public DigilibServletRequest(javax.servlet.http.HttpServletRequest request)
Creates a new instance of DigilibRequest with parameters from a ServletRequest. All undefined parameters are set to default values.- Parameters:
request
- the HttpServletRequest
-
DigilibServletRequest
public DigilibServletRequest(javax.servlet.http.HttpServletRequest request, DigilibConfiguration config)
Creates a new instance of DigilibRequest with parameters from a ServletRequest. All undefined parameters are set to default values.- Parameters:
request
- the HttpServletRequestconfig
- the DigilibConfiguration
-
DigilibServletRequest
public DigilibServletRequest(javax.servlet.http.HttpServletRequest request, DigilibConfiguration config, EnumSet<DigilibRequest.ParsingOption> parsingOptions)
Creates a new instance of DigilibRequest with parameters from a ServletRequest. All undefined parameters are set to default values.- Parameters:
request
- the HttpServletRequestconfig
- the DigilibConfigurationparsingOptions
- the ParsingOptions
-
-
Method Detail
-
initParams
protected void initParams()
Description copied from class:DigilibRequest
Define and set up parameters with default values.- Overrides:
initParams
in classDigilibRequest
-
initOptions
protected void initOptions()
Description copied from class:ParameterMap
set up options- Overrides:
initOptions
in classDigilibRequest
-
setWithRequest
public void setWithRequest(javax.servlet.http.HttpServletRequest request)
Populate the request object with data from a ServletRequest. Recognizes digilib API (old and new) and IIIF API style requests.- Parameters:
request
- the HttpServletRequest
-
setWithOldString
public void setWithOldString(String queryString)
Populate a request from a string in the old "++++" parameter form.- Parameters:
queryString
- String with paramters in the old "+++" form.
-
getAsString
public String getAsString()
Return the request parameters as a String in the parameter form 'fn=/icons&pn=1'. Empty (undefined) fields are not included.- Overrides:
getAsString
in classDigilibRequest
- Returns:
- String of request parameters in parameter form.
-
getAsString
public String getAsString(int type)
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.- Overrides:
getAsString
in classDigilibRequest
- Parameters:
type
- the type- Returns:
- String of request parameters in parameter form.
-
getAsOldString
public String getAsOldString()
Returns request parameters in old '++++' form.- Returns:
- String with parameters in old '++++' form.
-
setWithParamRequest
public void setWithParamRequest(javax.servlet.ServletRequest request)
Set request parameters from javax.servlet.ServletRequest. Uses the Requests getParameter methods for 'fn=foo' style parameters.- Parameters:
request
- ServletRequest to get parameters from.
-
setBaseURL
public void setBaseURL(javax.servlet.http.HttpServletRequest request)
Set the requests base URL parameter from a javax.sevlet.http.HttpServletRequest.- Parameters:
request
- HttpServletRequest to set the base URL.
-
getImage
public DocuImage getImage()
Returns the image.- Returns:
- DocuImage
-
setImage
public void setImage(DocuImage image)
Sets the image.- Parameters:
image
- The image to set
-
getServletRequest
public javax.servlet.http.HttpServletRequest getServletRequest()
Returns the ServletRequest.- Returns:
- the HttpServletRequest
-
-