aspose file tools*
The moose likes Struts and the fly likes Replacing an Interceptor in the Default Stack Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Replacing an Interceptor in the Default Stack" Watch "Replacing an Interceptor in the Default Stack" New topic
Author

Replacing an Interceptor in the Default Stack

James Gadbury
Greenhorn

Joined: Mar 20, 2009
Posts: 24
Hi all,

I have created my own workflow interceptor which I would like to replace the default workfloaw interceptor for some actions. I would like to define my own stack to be the same as the default stack but with my custom workflow interceptor in place.

I have done it the manual way. i.e:

<interceptors >
<interceptor name="dynamicInputWorkflow" class="one.of.my.packages.DynamicInputWorkflowInterceptor"/>
<interceptor-stack name="dynamicInputWorkflowStack" >
<interceptor-ref name="exception"/>
<interceptor-ref name="alias"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="i18n"/>
<interceptor-ref name="prepare"/>
<interceptor-ref name="chain"/>
<interceptor-ref name="debugging"/>
<interceptor-ref name="profiling"/>
<interceptor-ref name="scopedModelDriven"/>
<interceptor-ref name="modelDriven"/>
<interceptor-ref name="fileUpload"/>
<interceptor-ref name="checkbox"/>
<interceptor-ref name="staticParams"/>
<interceptor-ref name="actionMappingParams"/>
<interceptor-ref name="params">
<param name="excludeParams">dojo\..*,^struts\..*</param>
</interceptor-ref>
<interceptor-ref name="conversionError"/>
<interceptor-ref name="validation">
<param name="excludeMethods">input,back,cancel,browse</param>
</interceptor-ref>
<interceptor-ref name="dynamicInputWorkflow">
<param name="excludeMethods">input,back,cancel,browse</param>
</interceptor-ref>
</interceptor-stack>
</interceptors>

Is it possible to define a custom stack to use default stack and replace workflow interceptor with my own custom workflow interceptor without having to manually copy and paste the whole default interceptor stack?

Thanks for your help. Kind regards,

James
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No, although most stacks I've made have been composed of groups of other interceptors.

There is no way to "inject" an interceptor into a collection of others (nor should there be, in my opinion; too much possibility of abuse).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Replacing an Interceptor in the Default Stack
 
Similar Threads
Interceptor issue in Struts 2
bypassing interceptors
Struts 2 InterceptorStack Issues
Struts 2 Fileupload problem
Struts 2 file upload tag type allowed error