org.picocontainer.web.struts
Class PicoActionFactory
java.lang.Object
org.picocontainer.web.struts.PicoActionFactory
public final class PicoActionFactory
- 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. |
Class<?> |
getActionClass(String className)
|
protected Class<?> |
loadClass(String className)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PicoActionFactory
public PicoActionFactory()
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.PicoCompositionException
- 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 PicoCompositionException
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.PicoCompositionException - if the mapping type does not specify a
valid action.
org.picocontainer.PicoCompositionException - if no request, session, or application
scoped Pico container can be found.
getActionClass
public Class<?> getActionClass(String className)
throws org.picocontainer.PicoCompositionException
- Throws:
org.picocontainer.PicoCompositionException
loadClass
protected Class<?> loadClass(String className)
throws ClassNotFoundException
- Throws:
ClassNotFoundException
Copyright © 2008. All Rights Reserved.