GeeCON Prague 2014*
The moose likes Struts and the fly likes bypassing interceptors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "bypassing interceptors" Watch "bypassing interceptors" New topic
Author

bypassing interceptors

Vivek Chaitanya
Ranch Hand

Joined: Oct 19, 2007
Posts: 35
Hi All,

How to bypass some of the interceptors in defaultStack provided by Struts2?

Thanks
Chaitanya
ganta gopal
Greenhorn

Joined: Feb 05, 2009
Posts: 15
hi

To bypass some of the interceptors in the default stack.

Create your own interceptor stack and add what interceptors you want to the stack .
As you can also struts 2 by default is providing lot of stacks. you can see all the stacks in struts-default.xml



Vivek Chaitanya
Ranch Hand

Joined: Oct 19, 2007
Posts: 35
I put the following code in struts.xml



Does the above lines of code ensure that only the above interceptors are invoked? How will I verify that?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

That's just how S2 works--only interceptors in stacks being used are called.
Krishna Nagadev
Ranch Hand

Joined: Jan 04, 2005
Posts: 32
Facing the same problem..

instead of controlling it at configuration level, I want to bypass the execution of Action/next interceptors in the stack .. is it really possible ?
Let me explain my problem in detail here..

I need to check a cookie at interceptor and need to execute different actions based on cookie value.. I tried in below way, I am able to redirect the response to desired action and page but with exceptions. Here is the code ..


Error Message
java.lang.IllegalStateException: Cannot create a session after the response has been committed
org.apache.catalina.connector.Request.doGetSession(Request.java:2301)
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please start new threads for new questions.
 
GeeCON Prague 2014
 
subject: bypassing interceptors