Dave Belfer-Shevett wrote:
Hi folks - i'm trying to write an interceptor in struts2 that has
access to the ApplicationMap in the application context.
My understanding is that the webwork API for ApplicationAware means
that the interceptor will have it's setApplication(Map
applicationData); triggered when the interceptor is run, thereby
giving me access to the applicationcontext.
The ApplicationAware interface only applies to actions. It's actually a
feature of the ServletConfigInterceptor. That interceptor inspects the
target action for the interface and injects the Map if present.
XWork's dependency injection uses the @Inject annotation on properties
and constructions. It can inject beans it knows of, however the
application context is not one of them.
The simplest way to access the application context in your interceptor
is via the ActionInvocation argument:
ie. Map applicationContext =
actionInvocation.getIncovationContext().getApplication();
You can also inject beans directly into you interceptor via spring or
guice if you're using one of those DI frameworks.
Hope that helps,
Jeromy Evans
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]