public class ActionAutowiringInterceptor extends AbstractInterceptor implements org.springframework.context.ApplicationContextAware
<!-- 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.| Modifier and Type | Field and Description |
|---|---|
static String |
APPLICATION_CONTEXT |
| Constructor and Description |
|---|
ActionAutowiringInterceptor() |
| Modifier and Type | Method and Description |
|---|---|
protected org.springframework.context.ApplicationContext |
getApplicationContext() |
String |
intercept(ActionInvocation invocation)
Looks for the
ApplicationContext under the attribute that the Spring listener sets in
the servlet context. |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setAutowireStrategy(Integer autowireStrategy) |
destroy, initpublic static final String APPLICATION_CONTEXT
public void setAutowireStrategy(Integer autowireStrategy)
autowireStrategy - public String intercept(ActionInvocation invocation) throws Exception
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?intercept in interface Interceptorintercept in class AbstractInterceptorinvocation - ActionInvocation.invoke(), or from the interceptor itself.Exceptionpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareapplicationContext - org.springframework.beans.BeansExceptionprotected org.springframework.context.ApplicationContext getApplicationContext()
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.