Package digilib.conf
Class DigilibServletConfiguration
- java.lang.Object
-
- digilib.util.ParameterMap
-
- digilib.conf.DigilibConfiguration
-
- digilib.conf.DigilibServletConfiguration
-
- All Implemented Interfaces:
EventListener
,javax.servlet.ServletContextListener
- Direct Known Subclasses:
DigilibServlet3Configuration
,ManifestServletConfiguration
,PDFServletConfiguration
,TextServletConfiguration
public class DigilibServletConfiguration extends DigilibConfiguration implements javax.servlet.ServletContextListener
Class to hold the digilib servlet configuration parameters. The parameters can be read from the digilib-config file and be passed to other servlets or beans.
errorImgFileName: image file to send in case of error.
denyImgFileName: image file to send if access is denied.
baseDirs: array of base directories in order of preference (prescaled versions first).
useAuth: use authentication information.
authConfPath: authentication configuration file.
...- Author:
- casties
-
-
Field Summary
Fields Modifier and Type Field Description static String
AUTHN_OP_KEY
static String
AUTHZ_OP_KEY
static String
DIR_CACHE_KEY
static String
IMAGEEXECUTOR_KEY
static String
SERVLET_CONFIG_KEY
Long
webappStartTime
the time the webapp (i.e.-
Fields inherited from class digilib.conf.DigilibConfiguration
isLoggingConfigured, logger, propertiesFileName
-
Fields inherited from class digilib.util.ParameterMap
options, params
-
-
Constructor Summary
Constructors Constructor Description DigilibServletConfiguration()
Constructs DigilibServletConfiguration and defines all parameters and their default values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(javax.servlet.ServletContext context)
void
contextDestroyed(javax.servlet.ServletContextEvent cte)
void
contextInitialized(javax.servlet.ServletContextEvent cte)
protected String[]
expandBaseDirList(String[] dirs, javax.servlet.ServletContext c)
Resolve all paths in the basedir-list.static String
getClassVersion()
protected DigilibServletConfiguration
getContextConfig(javax.servlet.ServletContext context)
Returns the current DigilibConfiguration from the context.static DigilibServletConfiguration
getContextConfig(javax.servlet.ServletContext context, String dlconfigKey)
Returns the DigilibConfiguration with the given key from the context.static DigilibServletConfiguration
getCurrentConfig(javax.servlet.ServletContext context)
Returns the current DigilibConfiguration from the context.String
getVersion()
void
readConfig(javax.servlet.ServletContext c)
read parameter list from the file WEB-INF/digilib-config.xml or digilib.properties in class path.protected void
readConfigEntries(javax.servlet.ServletContext ctx, Map<String,String> conf)
protected void
setContextConfig(javax.servlet.ServletContext context)
Sets the current DigilibConfiguration in the context.protected void
setupLogging(javax.servlet.ServletContext context)
Initialize the logging implementation.-
Methods inherited from class digilib.conf.DigilibConfiguration
configure, readConfig, setSpecialValueFromString, setupLogging
-
Methods inherited from class digilib.util.ParameterMap
cloneInstance, get, getAsBoolean, getAsFile, getAsFloat, getAsInt, getAsString, getInstance, getOptions, getParameters, getParams, getValue, hasOption, hasValue, initOptions, initParams, newParameter, newParameter, put, put, setOptions, setParams, setValue, setValue, setValue, setValueFromString
-
-
-
-
Field Detail
-
AUTHN_OP_KEY
public static final String AUTHN_OP_KEY
- See Also:
- Constant Field Values
-
AUTHZ_OP_KEY
public static final String AUTHZ_OP_KEY
- See Also:
- Constant Field Values
-
IMAGEEXECUTOR_KEY
public static final String IMAGEEXECUTOR_KEY
- See Also:
- Constant Field Values
-
SERVLET_CONFIG_KEY
public static final String SERVLET_CONFIG_KEY
- See Also:
- Constant Field Values
-
DIR_CACHE_KEY
public static final String DIR_CACHE_KEY
- See Also:
- Constant Field Values
-
webappStartTime
public final Long webappStartTime
the time the webapp (i.e. this class) was loaded
-
-
Method Detail
-
getClassVersion
public static String getClassVersion()
-
getVersion
public String getVersion()
- Overrides:
getVersion
in classDigilibConfiguration
-
readConfig
public void readConfig(javax.servlet.ServletContext c) throws SAXException, IOException
read parameter list from the file WEB-INF/digilib-config.xml or digilib.properties in class path.- Parameters:
c
- the ServletContext- Throws:
IOException
- on errorSAXException
- on error
-
readConfigEntries
protected void readConfigEntries(javax.servlet.ServletContext ctx, Map<String,String> conf)
- Parameters:
ctx
- the ServletContextconf
- the config
-
configure
public void configure(javax.servlet.ServletContext context)
-
contextInitialized
public void contextInitialized(javax.servlet.ServletContextEvent cte)
- Specified by:
contextInitialized
in interfacejavax.servlet.ServletContextListener
-
contextDestroyed
public void contextDestroyed(javax.servlet.ServletContextEvent cte)
- Specified by:
contextDestroyed
in interfacejavax.servlet.ServletContextListener
-
setContextConfig
protected void setContextConfig(javax.servlet.ServletContext context)
Sets the current DigilibConfiguration in the context.- Parameters:
context
- the ServletContext
-
getContextConfig
public static DigilibServletConfiguration getContextConfig(javax.servlet.ServletContext context, String dlconfigKey)
Returns the DigilibConfiguration with the given key from the context.- Parameters:
context
- the ServletContextdlconfigKey
- the context key for the configuration- Returns:
- the DigilibConfiguration
-
getCurrentConfig
public static DigilibServletConfiguration getCurrentConfig(javax.servlet.ServletContext context)
Returns the current DigilibConfiguration from the context.- Parameters:
context
- the ServletContext- Returns:
- the DigilibConfiguration
-
getContextConfig
protected DigilibServletConfiguration getContextConfig(javax.servlet.ServletContext context)
Returns the current DigilibConfiguration from the context. (non-static method, for Java inheritance)- Parameters:
context
- the ServletContext- Returns:
- the DigilibConfiguration
-
expandBaseDirList
protected String[] expandBaseDirList(String[] dirs, javax.servlet.ServletContext c)
Resolve all paths in the basedir-list. SeeServletOps.getFile(File, ServletContext)
for resolution logic.
-
setupLogging
protected void setupLogging(javax.servlet.ServletContext context)
Initialize the logging implementation.- Parameters:
context
-
-
-