• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

endless loop with interceptor

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi!

i have in my struts.xml the followings:


i wrote an interceptor, that i would like to be invoked after excecuting an action and before showing the results:


the interceptor codes needs to check that 20 minutes didn't pass since session started. (i didn't declared the session end time in web.xml since it comes from the database as a parameter).

However, when i run it - the browser gets into an endless loop.

Why is it?

thanks!
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay I'm really not sure what you are trying to achieve with that code, but are you only trying to send the user to a different result page if the session has expired?? If so, why are you doing that after the action has executed?? Any user with no session should generally not even have access to the action. And if the actual goal is just to implement session timeout, you can set the session timeout of the session object from the value of the database in your action or a filter. The browser is going into a loop because session-timeout is a redirect result. So the browser will make a new request for that result, and then the interceptor will be fired again which will again redirect the browser. The solution is that you do not apply this interceptor to the getMainAction action...
 
Jordan Smith
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you are right.

is there a way to apply a default interceptor to all the actions except for one?
 
Ankit Garg
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just leave the default stack that you've created as it is and use a different interceptor stack for that particular action. Look at the configurations in this page to see how its done...
 
reply
    Bookmark Topic Watch Topic
  • New Topic