org.nanocontainer.nanowar.struts
Class ActionFactory
java.lang.Object
org.nanocontainer.nanowar.struts.ActionFactory
- public class ActionFactory
- extends Object
Uses PicoContainer to produce Actions and inject dependencies into them.
If you have your own RequestProcessor
implementation, you can use an
ActionFactory
in your RequestProcessor.processActionCreate
method to Picofy your Actions.
- Author:
- Stephen Molitor, Mauro Talevi
Method Summary |
org.apache.struts.action.Action |
getAction(javax.servlet.http.HttpServletRequest request,
org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionServlet servlet)
Gets the Action specified by the mapping type from a PicoContainer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ActionFactory
public ActionFactory()
getAction
public org.apache.struts.action.Action getAction(javax.servlet.http.HttpServletRequest request,
org.apache.struts.action.ActionMapping mapping,
org.apache.struts.action.ActionServlet servlet)
throws org.picocontainer.PicoIntrospectionException,
org.picocontainer.PicoInitializationException
- Gets the
Action
specified by the mapping type from a PicoContainer.
The action will be instantiated if necessary, and its
dependencies will be injected. The action will be instantiated via a
special PicoContainer that just contains actions. If this container
already exists in the request attribute, this method will use it. If no
such container exists, this method will create a new Pico container and
place it in the request. The parent container will either be the request
container, or if that container can not be found the session container,
or if that container can not be found, the application container. If no
parent container can be found, a PicoInitializationException
will be thrown. The action path specified in the mapping is used as
the component key for the action.
- Parameters:
request
- the Http servlet request.mapping
- the Struts mapping object, whose type property tells us what
Action class is required.servlet
- the Struts ActionServlet
.
- Returns:
- the
Action
instance.
- Throws:
org.picocontainer.PicoIntrospectionException
- if the mapping type does not specify a valid action.
org.picocontainer.PicoInitializationException
- if no request, session, or application scoped Pico container
can be found.
Copyright © 2003-2006 Codehaus. All Rights Reserved.