|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object toolbox.web.BaseWebAction
public class BaseWebAction
Base class that may be extended when implementing the WebAction interface.
This class provides an implementation of the create() method and provides access to the action configuration properties.
Constructor Summary | |
---|---|
protected |
BaseWebAction()
protected constructor. |
Method Summary | |
---|---|
void |
create(java.lang.String name,
Controller controller,
javax.servlet.ServletContext context)
A default implementation of the create() method specified in the WebAction interface. |
protected void |
dispatch(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.ServletContext context,
java.lang.String template)
Dispatches the given request and response to the given template. |
protected org.w3c.dom.Document |
getBodyAsDocument(javax.servlet.http.HttpServletRequest request)
Convenience method to return the given HTTP request's body as an XML Document instance. |
protected java.lang.String |
getBodyAsString(javax.servlet.http.HttpServletRequest request)
Convenience method to return the given HTTP request body as a String instance. |
protected java.lang.String |
getDisplayTemplate()
Returns the location of the display template. |
protected java.lang.String |
getFailureTemplate()
Returns the location of the failure template. |
protected javax.servlet.ServletContext |
getForeignContext(java.lang.String foreignContext,
javax.servlet.ServletContext context)
Return the foreign context represented by the given string. |
protected java.lang.String |
getGlobalProperty(java.lang.String name)
Return the named global configuration property. |
protected java.lang.String |
getMessage()
Returns the default display message |
protected java.lang.String |
getName()
Return the name of this action. |
protected java.util.Map |
getProperties()
Return configuration properties as a Map. |
protected java.lang.String |
getProperty(java.lang.String name)
Return the named configuration property. |
protected java.lang.String |
getResource()
Return the name of the resource configured for this action. |
protected java.util.ResourceBundle |
getResourceBundle(java.util.Locale locale)
Return the resource bundle configured for this action. |
protected java.lang.String |
getResourceString(java.util.ResourceBundle bundle,
java.lang.String key,
java.lang.Object[] args)
Return a resource string from the given bundle and format the string using the array of parameters provided. |
protected java.lang.String |
getResourceString(java.lang.String key)
Return a resource string from the bundle configured for this action |
protected java.lang.String |
getResourceString(java.lang.String key,
java.util.Locale locale)
Return a resource string from the bundle configured for this action |
protected java.lang.String |
getResourceString(java.lang.String key,
java.lang.Object[] args)
Return a resource string from the bundle configured for this action and format the string using the List of parameters provided. |
protected java.lang.String |
getResourceString(java.lang.String key,
java.lang.Object[] args,
java.util.Locale locale)
Return a resource string from the bundle configured for this action and format the string using the List of parameters provided. |
protected java.lang.String |
getSuccessTemplate()
Returns the location of the success template. |
protected java.lang.String |
getTemplate(java.lang.String name)
Return the location of the named template. |
protected Validator |
getValidator()
Returns the validator instance for this action. |
protected void |
logConfig(java.lang.String msg)
Log a config message. |
protected void |
logFine(java.lang.String msg)
Log a fine message. |
protected void |
logFiner(java.lang.String msg)
Log a finer message. |
protected void |
logFinest(java.lang.String msg)
Log a finest message. |
protected void |
logInfo(java.lang.String msg)
Log an info message. |
protected void |
logSevere(java.lang.String msg,
java.lang.Throwable ex)
Log a severe message. |
protected void |
logWarning(java.lang.String msg,
java.lang.Throwable ex)
Log a warning message. |
protected void |
redirect(javax.servlet.http.HttpServletResponse response,
java.lang.String redirect)
Perform a redirect to the given target URL. |
protected java.util.List |
split(java.util.List list,
int pageSize)
Split the given list into equal sub lists and return a new list containing all the created sub lists. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected BaseWebAction()
Method Detail |
---|
public void create(java.lang.String name, Controller controller, javax.servlet.ServletContext context) throws ConfException
This method sets the relevant template, message and name parameters for the implemented action.
name
- Action name.controller
- Controller that created this action.context
- Current servlet context.
ConfException
- if the action cannot be created.protected Validator getValidator()
protected java.lang.String getName()
protected java.lang.String getDisplayTemplate()
protected java.lang.String getSuccessTemplate()
protected java.lang.String getFailureTemplate()
protected java.lang.String getTemplate(java.lang.String name)
name
- String containing a template name.
protected java.lang.String getMessage()
protected java.lang.String getResource()
protected java.lang.String getProperty(java.lang.String name)
name
- String containing the name of the poperty to return.
protected java.util.Map getProperties()
protected java.lang.String getGlobalProperty(java.lang.String name)
name
- String containing the name of the global poperty to return.
protected java.util.ResourceBundle getResourceBundle(java.util.Locale locale) throws javax.servlet.ServletException
locale
- Attempt to return a resource for this locale.
javax.servlet.ServletException
protected java.lang.String getResourceString(java.lang.String key, java.util.Locale locale) throws javax.servlet.ServletException
key
- String key to use for resource lookup.locale
- The current request locale.
javax.servlet.ServletException
- if the resource cannot be found.protected java.lang.String getResourceString(java.lang.String key) throws javax.servlet.ServletException
key
- String key to use for resource lookup.
javax.servlet.ServletException
- if the resource cannot be found.protected java.lang.String getResourceString(java.lang.String key, java.lang.Object[] args, java.util.Locale locale) throws javax.servlet.ServletException
key
- String key use for resource lookup.args
- Object array containing arguments.locale
- The current request locale.
javax.servlet.ServletException
- if the resource cannot be found.protected java.lang.String getResourceString(java.lang.String key, java.lang.Object[] args) throws javax.servlet.ServletException
key
- String key use for resource lookup.args
- Object array containing arguments.
javax.servlet.ServletException
- if the resource cannot be found.protected java.lang.String getResourceString(java.util.ResourceBundle bundle, java.lang.String key, java.lang.Object[] args) throws javax.servlet.ServletException
bundle
- ResourceBundle to use.key
- String key use for resource lookup.args
- Object array containing arguments.
javax.servlet.ServletException
- if the resource cannot be found.protected java.lang.String getBodyAsString(javax.servlet.http.HttpServletRequest request) throws java.io.IOException
request
- Convert this request's body into a String.
java.io.IOException
- if the body cannot be read.protected org.w3c.dom.Document getBodyAsDocument(javax.servlet.http.HttpServletRequest request) throws java.io.IOException
request
- Convert this request's body into a Document.
java.io.IOException
- if the body cannot be read.protected java.util.List split(java.util.List list, int pageSize)
list
- The List that must be split.pageSize
- The number of entries per sub list.
protected void logFinest(java.lang.String msg)
msg
- String containing message to log.protected void logFiner(java.lang.String msg)
msg
- String containing message to log.protected void logFine(java.lang.String msg)
msg
- String containing message to log.protected void logConfig(java.lang.String msg)
msg
- String containing message to log.protected void logInfo(java.lang.String msg)
msg
- String containing message to log.protected void logWarning(java.lang.String msg, java.lang.Throwable ex)
msg
- String containing message to log.ex
- Optional throwable to include in the log.protected void logSevere(java.lang.String msg, java.lang.Throwable ex)
msg
- String containing message to log.ex
- Optional throwable to include in the log.protected void redirect(javax.servlet.http.HttpServletResponse response, java.lang.String redirect) throws java.io.IOException
response
- Servlet response.redirect
- String containing the redirect URL.
java.io.IOException
protected void dispatch(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.ServletContext context, java.lang.String template) throws javax.servlet.ServletException, java.io.IOException
request
- Servlet request.response
- Servlet response.context
- Servlet context.template
- Target template.
javax.servlet.ServletException
java.io.IOException
protected javax.servlet.ServletContext getForeignContext(java.lang.String foreignContext, javax.servlet.ServletContext context)
foreignContext
- String representing the foreing context.context
- Current context instance.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |