com.opensymphony.webwork.dispatcher.mapper
Class CompositeActionMapper

java.lang.Object
  extended by com.opensymphony.webwork.dispatcher.mapper.CompositeActionMapper
All Implemented Interfaces:
ActionMapper

public class CompositeActionMapper
extends Object
implements ActionMapper

This is an ActionMapper that could take in ActionMappers and consult each ActionMapper in the order they are given where ActionMapper with higher order will take precedence.

The pre-defined ActionMappers could be configured in 2 ways :-

Through webwork.properties

CompositeActionMapper does this by reading in the pre-configured ActionMappers through webwork.properties file eg. with

   webwork.mapper.class=com.opensymphony.webwork.dispatcher.mapper.CompositeActionMapper
   webwork.compositeActionMapper.1=com.opensymphony.webwork.dispatcher.mapper.RestfulActionMapper
   webwork.compositeActionMapper.2=com.opensymphony.webwork.dispatcher.mapper.DefaultActionMapper
 
We would have configured a CompositeActionMapper, with 2 pre-configured ActionMappers, namely where RestfulActionMapper will be consulted first before DefaultActionMapper as it has a higher order. ActionMapper with a lower order will be consulted first. Through constructor (normally for unit testing)

CompositeActionMapper does this with the pre-configured ActionMappers passed in as an array. The order of the ActionMappers is important as they will be consulted in order.

Version:
$Date$ $Id$
Author:
tmjee

Nested Class Summary
protected  class CompositeActionMapper.ActionMapperInfo
          Encapsulate the ActionMapper and its order in this CompositeActionMapper.
 
Constructor Summary
CompositeActionMapper()
          Creates an instance of CompositeActionMapper, reading in the pre-configured ActionMappers through webwork.properties file eg.
CompositeActionMapper(ActionMapper[] actionMappers)
          Creates an instance of CompositeActionMapper with the pre-configured ActionMappers passed in as an array.
 
Method Summary
protected  List getActionMapperInfos()
          Returns a list of CompositeActionMapper.ActionMapperInfo, preconfigured in this CompositeActionMapper.
 ActionMapping getMapping(HttpServletRequest request)
          This method will go through all the pre-configured ActionMappers in the order defined, and return the ActionMapping of the first ActionMapper that returns a valid (non-null) ActionMapping
 String getUriFromActionMapping(ActionMapping mapping)
          This method will go through all the pre-configured ActionMappers in the order defined, and return the URI of the first that returns a valid (non-null) URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeActionMapper

public CompositeActionMapper()
Creates an instance of CompositeActionMapper, reading in the pre-configured ActionMappers through webwork.properties file eg. with
   webwork.mapper.class=com.opensymphony.webwork.dispatcher.mapper.CompositeActionMapper
   webwork.compositeActionMapper.1=com.opensymphony.webwork.dispatcher.mapper.RestfulActionMapper
   webwork.compositeActionMapper.2=com.opensymphony.webwork.dispatcher.mapper.DefaultActionMapper
 
We would have configured a CompositeActionMapper, with 2 pre-configured ActionMappers, namely where RestfulActionMapper will be consulted first before DefaultActionMapper as it has a higher order. ActionMapper with a lower order will be consulted first.


CompositeActionMapper

public CompositeActionMapper(ActionMapper[] actionMappers)
Creates an instance of CompositeActionMapper with the pre-configured ActionMappers passed in as an array. The order of the ActionMappers is important as they will be consulted in order.

Parameters:
actionMappers - Array of ActionMappers
Method Detail

getMapping

public ActionMapping getMapping(HttpServletRequest request)
This method will go through all the pre-configured ActionMappers in the order defined, and return the ActionMapping of the first ActionMapper that returns a valid (non-null) ActionMapping

Specified by:
getMapping in interface ActionMapper
Parameters:
request - HttpServletRequest
Returns:
ActionMapping

getUriFromActionMapping

public String getUriFromActionMapping(ActionMapping mapping)
This method will go through all the pre-configured ActionMappers in the order defined, and return the URI of the first that returns a valid (non-null) URI.

Specified by:
getUriFromActionMapping in interface ActionMapper
Parameters:
mapping - ActionMapping
Returns:
String

getActionMapperInfos

protected List getActionMapperInfos()
Returns a list of CompositeActionMapper.ActionMapperInfo, preconfigured in this CompositeActionMapper.

Returns:
List of CompositeActionMapper.ActionMapperInfo

WebWork Project Page