|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.GenericServlet javax.servlet.http.HttpServlet org.apache.commons.scaffold.http.ResourceServlet
public class ResourceServlet
Base servlet for loading application resources.
Constructor Summary | |
---|---|
ResourceServlet()
|
Method Summary | |
---|---|
void |
destroy()
Gracefully shut down this controller servlet, releasing any resources that were allocated at initialization. |
protected void |
destroyCustom()
Release any custom resources created at initialization |
protected void |
destroyDefault()
Release any default resources created at initialization |
int |
getInitInt(String parameter,
int defaultValue)
Check for a parameter and returns a default value if not found, or if the value does not convert to an int . |
Map |
getInitParameters()
Return a map of this servlet's initialization parameters. |
String |
getInitString(String parameter,
String defaultValue)
Check for a parameter and returns a default value if not found. |
Properties |
getProperties()
Return the default properties object. |
void |
init()
Initialize this servlet by caling three extension points: initLogging
initDefault
initCustom
The main extension point is initCustom
The default implementation does nothing. |
protected void |
initCustom()
Initialize the custom properties or objects for this application. |
protected void |
initDefault()
Initialize the default properties for this application. |
Properties |
loadProperties(String parameter,
String defaultPath,
String attribute)
A utility method for loading a Properties file specified by an initialization parameter. |
void |
reload()
Reload the configuration of this controller servlet from our underlying configuration files. |
void |
setProperties(Properties properties)
Set the default properties object. |
Methods inherited from class javax.servlet.http.HttpServlet |
---|
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
---|
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ResourceServlet()
Method Detail |
---|
public String getInitString(String parameter, String defaultValue)
parameter
- The attribute name to look fordefaultValue
- The default to return if the parameter is not found
public int getInitInt(String parameter, int defaultValue)
int
.
parameter
- The attribute name to look for
public Map getInitParameters()
public void setProperties(Properties properties)
public Properties getProperties()
public Properties loadProperties(String parameter, String defaultPath, String attribute) throws javax.servlet.ServletException
parameter
- The name of the initialization
parameterdefaultPath
- The path to use if the
parameter is not foundattribute
- If not null, store in
application scope under this attribute name
javax.servlet.ServletException
protected void initDefault() throws IOException, javax.servlet.ServletException
Use the default
initialization parameter to specify
another path. Otherwise ["resources/default.properties"] is used.
If the default properties will not be used or specified, override this method with one that does not try to load the default properties.
IOException
- if an input/output error is encountered
javax.servlet.ServletException
- if we cannot initialize these resourcesprotected void destroyDefault()
public void init() throws javax.servlet.ServletException
initLogging
initDefault
initCustom
initCustom
The default implementation does nothing.
The other two methods have reasonable default behaviors that most
subclasses could use as-is.
This may be called again from reload
and should be
"re-enterant".
init
in class javax.servlet.GenericServlet
javax.servlet.ServletException
- if we cannot configure ourselves
correctlypublic void destroy()
destroy
in interface javax.servlet.Servlet
destroy
in class javax.servlet.GenericServlet
protected void initCustom() throws IOException, javax.servlet.ServletException
IOException
- if an input/output error is encountered
javax.servlet.ServletException
- if we cannot initialize these resourcesprotected void destroyCustom()
public void reload() throws IOException, javax.servlet.ServletException
IOException
- if an input/output error occurs
javax.servlet.ServletException
- if a servlet exception occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |