Reputation: 41
In struts.xml
, I have included tokenSession
interceptor to my interceptor-stack to validate token for each request. Unfortunately, the same isn't working well for AJAX requests. I got invalid.token
response when it executes actionInvocation.invoke()
.
Hence, I would like to stop executing tokenSession interceptor for AJAX requests (alone). I have a custom interceptor (logging) which get invoked prior to tokenSession
interceptor. Is it possible to delete tokenSession
interceptor from stack in logging interceptor based on request type (if it is an AJAX request)?
Upvotes: 4
Views: 614
Reputation: 24396
Token interceptor extends MethodFilterInterceptor
that means that you can exclude execution of interceptor bases on method names.
In your interceptor stack configure it like that:
<interceptor-ref name="token">
<param name="excludeMethods">your_ajax_methods_comma_separated</param>
</interceptor-ref>
Another solution is to use different interceptor stack for you AJAX actions.
Upvotes: 2
Reputation: 50261
Use a different Interceptor Stack for your Action, or use different Interceptor Stacks for different packages, and group all the Actions in the right package.
Upvotes: 2