net.sourceforge.stripes.controller
Class DefaultActionBeanContextFactory

java.lang.Object
  extended by net.sourceforge.stripes.controller.DefaultActionBeanContextFactory
All Implemented Interfaces:
ConfigurableComponent, ActionBeanContextFactory

public class DefaultActionBeanContextFactory
extends Object
implements ActionBeanContextFactory

Implements an ActionBeanContextFactory that allows for instantiation of application specific ActionBeanContext classes. Looks for a configuration parameters called "ActionBeanContext.Class". If the property is present, the named class with be instantiated and returned from the getContextInstance() method. If no class is named, then the default class, ActionBeanContext will be instantiated.

Author:
Tim Fennell

Field Summary
static String CONTEXT_CLASS_NAME
          The name of the configuration property used for the context class name.
 
Constructor Summary
DefaultActionBeanContextFactory()
           
 
Method Summary
protected  Configuration getConfiguration()
           
 ActionBeanContext getContextInstance(HttpServletRequest request, HttpServletResponse response)
          Returns a new instance of the configured class, or ActionBeanContext if a class is not specified.
 void init(Configuration configuration)
          Stores the configuration, and looks up the ActionBeanContext class specified.
protected  void setConfiguration(Configuration configuration)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_CLASS_NAME

public static final String CONTEXT_CLASS_NAME
The name of the configuration property used for the context class name.

See Also:
Constant Field Values
Constructor Detail

DefaultActionBeanContextFactory

public DefaultActionBeanContextFactory()
Method Detail

init

public void init(Configuration configuration)
          throws Exception
Stores the configuration, and looks up the ActionBeanContext class specified.

Specified by:
init in interface ConfigurableComponent
Parameters:
configuration - the Configuration object being used by Stripes
Throws:
Exception - should be thrown if the component cannot be configured well enough to use.

getContextInstance

public ActionBeanContext getContextInstance(HttpServletRequest request,
                                            HttpServletResponse response)
                                     throws ServletException
Returns a new instance of the configured class, or ActionBeanContext if a class is not specified.

Specified by:
getContextInstance in interface ActionBeanContextFactory
Parameters:
request - the current HttpServletRequest
response - the current HttpServletResponse
Returns:
a new instance of ActionBeanContext
Throws:
ServletException - if the ActionBeanContext class configured cannot be instantiated

getConfiguration

protected Configuration getConfiguration()

setConfiguration

protected void setConfiguration(Configuration configuration)


? Copyright 2005-2006, Stripes Development Team.