org.beyondcode.struts.dispatcher
Class DispatcherMappingImpl

java.lang.Object
  |
  +--org.apache.struts.action.ActionMapping
        |
        +--org.beyondcode.struts.dispatcher.DispatcherMappingImpl
All Implemented Interfaces:
DispatcherMapping, java.io.Serializable

public class DispatcherMappingImpl
extends org.apache.struts.action.ActionMapping
implements DispatcherMapping

This class provides a default implementation of the DispatcherMapping interface. It can be used instead of org.apache.struts.action.ActionMapping with the dispatcher package. Specify in the deployment descriptor web.xml:

   <servlet>
     ...
     <init-param>
       <param-name>mapping</param-name>
       <param-value>org.beyondcode.struts.dispatcher.DispatcherMappingImpl</param-value>
     </init-param>
   </servlet>
   
This class also provides a simple selftest method, which can be used to check the mappings read from struts-config.xml for existence of all four "standard" forwards.

Author:
Philipp K. Janert
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.struts.action.ActionMapping
attribute, forward, forwards, include, input, instance, mappings, multipartClass, name, parameter, path, prefix, scope, suffix, type, unknown, validate
 
Constructor Summary
DispatcherMappingImpl()
           
 
Method Summary
 org.apache.struts.action.ActionForward denied()
          Get the 'access denied' ActionForward.
 org.apache.struts.action.ActionForward error()
          Get the 'error' ActionForward.
 org.apache.struts.action.ActionForward failure()
          Get the 'failure' ActionForward.
 java.lang.String getAccess()
          Get the access control information for this mapping.
 java.lang.String getMethod()
          Get the name of the function to which this action should be dispatched.
static java.lang.String[] reportErrors(org.apache.struts.action.ActionMappings allMappings)
          Given the ActionMappings maintained by the ActionServlet, this function checks whether the non-null "standard" forwards exist for all mappings.
 void setAccess(java.lang.String a)
          Set the access control information for this mapping.
 void setMethod(java.lang.String m)
          Set the name of the function to which this action should be dispatched.
 org.apache.struts.action.ActionForward success()
          Get the 'success' ActionForward.
 
Methods inherited from class org.apache.struts.action.ActionMapping
addForward, createFormInstance, findForward, findForwards, getActionClass, getAttribute, getFormAttribute, getFormClass, getFormPrefix, getFormScope, getFormSuffix, getForward, getInclude, getInput, getInputForm, getMappings, getMultipartClass, getName, getParameter, getPath, getPrefix, getScope, getSuffix, getType, getUnknown, getValidate, removeForward, setActionClass, setAttribute, setFormAttribute, setFormClass, setFormPrefix, setFormScope, setFormSuffix, setForward, setInclude, setInput, setInputForm, setMappings, setMultipartClass, setName, setParameter, setPath, setPrefix, setScope, setSuffix, setType, setUnknown, setValidate, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DispatcherMappingImpl

public DispatcherMappingImpl()
Method Detail

getMethod

public java.lang.String getMethod()
Get the name of the function to which this action should be dispatched.

Specified by:
getMethod in interface DispatcherMapping
Returns:
The method name;

setMethod

public void setMethod(java.lang.String m)
Set the name of the function to which this action should be dispatched.

Specified by:
setMethod in interface DispatcherMapping
Parameters:
m - The method name;

getAccess

public java.lang.String getAccess()
Get the access control information for this mapping.

Specified by:
getAccess in interface DispatcherMapping
Returns:
The access information.

setAccess

public void setAccess(java.lang.String a)
Set the access control information for this mapping.

Specified by:
setAccess in interface DispatcherMapping
Parameters:
a - The access information.

success

public org.apache.struts.action.ActionForward success()
Get the 'success' ActionForward.

Specified by:
success in interface DispatcherMapping
Returns:
ActionForward for "success", null if not found.

failure

public org.apache.struts.action.ActionForward failure()
Get the 'failure' ActionForward.

Specified by:
failure in interface DispatcherMapping
Returns:
ActionForward for "failure". If this is not found, the global error forward is returned, if this is not found, null is returned.

denied

public org.apache.struts.action.ActionForward denied()
Get the 'access denied' ActionForward.

Specified by:
denied in interface DispatcherMapping
Returns:
ActionForward for "denied". If this is not found, the global forward for "denied" is returned, if this is not found, the global "error" forward is returned, if this is not found, null is returned.

error

public org.apache.struts.action.ActionForward error()
Get the 'error' ActionForward.

Specified by:
error in interface DispatcherMapping
Returns:
ActionForward for "error". If this is not found, the global "error" forward is returned, if this is not found, null is returned.

reportErrors

public static java.lang.String[] reportErrors(org.apache.struts.action.ActionMappings allMappings)
Given the ActionMappings maintained by the ActionServlet, this function checks whether the non-null "standard" forwards exist for all mappings. The four forward names considered "standard" are "success", "failure", "denied", and "error".

Returns:
An array of error messages. A zero-length array indicates that all mappings possess all for standard forwards.