aspose file tools*
The moose likes Struts and the fly likes Overriding default interceptor stack Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Overriding default interceptor stack" Watch "Overriding default interceptor stack" New topic
Author

Overriding default interceptor stack

Renga Ramanujam
Greenhorn

Joined: Apr 17, 2010
Posts: 5
Hi,

In my application we have a customized interceptor stack. It acts as a default interceptor stack. This stack doesnt have validation and workflow attached with it. Now for a specific action class we need to use validate() method.
So we created a new interceptor stack with validation and work flow interceptor.

But still default interceptor alone getting called, the new one is not getting called. Can someone please help me?

Regards,
Renga
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

whatever interceptors are included in to your interceptors stack those only going to execute, post your interceptors stack how you declared.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Renga Ramanujam
Greenhorn

Joined: Apr 17, 2010
Posts: 5
Hi,

Please find my interceptor stack configuration along with action classes below.

<package name="default" extends="struts-default">
<interceptor-stack name=”AppStack”>
<interceptor-ref name="exception"/>
<interceptor-ref name="alias"/>
<interceptor-ref name="params"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="params"/>

</interceptor-stack>

<interceptor-stack name=”GuiStack”>
<interceptor-ref name="exception"/>
<interceptor-ref name="alias"/>
<interceptor-ref name="params"/>
<interceptor-ref name="servletConfig"/>
<interceptor-ref name="params"/>
<interceptor-ref name="validation" />
<interceptor-ref name="workflow" />

</interceptor-stack>

<default-interceptor-ref name="AppStack"/>


<action name="test"
class="com.jranch.Test">
<interceptor-ref name="GuiStack”/>
<result name="input">login.jsp</result>
<result name="success"
type="redirect-action">/secure/home</result>
</action>
</package>


The problem which I am facing is in Test class validate method is not getting called, If I add the validation and workflow interceptor to AppStack it works fine but I cant do that because it affects already existing classes
Jesus Mireles
Ranch Hand

Joined: Mar 10, 2010
Posts: 122

Looks right except im sure you have the interceptor stacks wrapped in a interceptors tag even though you dont post like that?

Anyway, you should turn up debug and you'll see what interceptors are being used.

Renga Ramanujam
Greenhorn

Joined: Apr 17, 2010
Posts: 5
Yeah looks right to me too. Can we never override default interceptor stack? How can we check which interceptors have buit?
Renga Ramanujam
Greenhorn

Joined: Apr 17, 2010
Posts: 5
Hi,

Its resolved now. The problem is the new interceptor stack is present different XML. It was not properly included in mail struts.xml. Sorry for the disturbance.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Overriding default interceptor stack