Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.opensymphony.xwork2.spring.interceptor
Class ActionAutowiringInterceptor

    java.lang.Object
      com.opensymphony.xwork2.interceptor.AbstractInterceptor
          com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor

All Implemented Interfaces:
  Interceptor, Serializable

    public class ActionAutowiringInterceptor

extends AbstractInterceptor

TODO: Give a description of the Interceptor. TODO: Describe the paramters for this Interceptor. TODO: Discuss some possible extension of the Interceptor.

     <!-- TODO: Describe how the Interceptor reference will effect execution -->
     <action name="someAction" class="com.examples.SomeAction">
          TODO: fill in the interceptor reference.
         <interceptor-ref name=""/>
         <result name="success">good_result.ftl</result>
     </action>

Autowires action classes to Spring beans. The strategy for autowiring the beans can be configured by setting the parameter on the interceptor. Actions that need access to the `ActionContext` can implements the `ApplicationContextAware` interface. The context will also be placed on the action context under the APPLICATION_CONTEXT attribute.

Author:
  Simon Stewart, Eric Hauser
See Also:
  Serialized Form

Field Summary
`static String` | `APPLICATION_CONTEXT`
`private Integer` | `autowireStrategy`
`private ApplicationContext` | `context`
`private SpringObjectFactory` | `factory`
`private boolean` | `initialized`
`private static Log` | `log`

Constructor Summary
`ActionAutowiringInterceptor()`

Method Summary
`protected ApplicationContext` | `getApplicationContext()`
`String` | `intercept(ActionInvocation invocation)` Looks for the `ApplicationContext` under the attribute that the Spring listener sets in the servlet context.
`void` | `setApplicationContext(ApplicationContext applicationContext)`
`void` | `setAutowireStrategy(Integer autowireStrategy)`

Methods inherited from class com.opensymphony.xwork2.interceptor.AbstractInterceptor
`destroy, init`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    private static final Log log

### APPLICATION_CONTEXT

    public static final String APPLICATION_CONTEXT

See Also:
  Constant Field Values

### initialized

    private boolean initialized

### context

    private ApplicationContext context

### factory

    private SpringObjectFactory factory

### autowireStrategy

    private Integer autowireStrategy

Constructor Detail

### ActionAutowiringInterceptor

    public ActionAutowiringInterceptor()

Method Detail

### setAutowireStrategy

    public void setAutowireStrategy(Integer autowireStrategy)

  Parameters:
    `autowireStrategy` -

### intercept

    public String intercept(ActionInvocation invocation)
                     throws Exception

  Looks for the `ApplicationContext` under the attribute that the Spring listener sets in the servlet context. The configuration is done the first time here instead of in init() since the `ActionContext` is not available during `Interceptor` initialization.

  Autowires the action to Spring beans and places the `ApplicationContext` on the `ActionContext`

  TODO Should this check to see if the `SpringObjectFactory` has already been configured instead of instantiating a new one? Or is there a good reason for the interceptor to have it's own factory?

  Specified by:
    `intercept` in interface `Interceptor`
  Specified by:
    `intercept` in class `AbstractInterceptor`
  Parameters:
    `invocation` -
  Returns:
    the return code, either returned from `ActionInvocation.invoke()`, or from the interceptor itself.
  Throws:
    `Exception`

### setApplicationContext

    public void setApplicationContext(ApplicationContext applicationContext)
                               throws BeansException

  Parameters:
    `applicationContext` -
  Throws:
    `BeansException`

### getApplicationContext

    protected ApplicationContext getApplicationContext()

  Returns:
    context

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.