• 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

Session timeout and redirecting to login.

 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again all. I am working on my struts app and I now want to put in a mechanism to handle timeouts. When a user leaves their application for the timeout time, if they click on anything I want them to be redirected to the login page. I have a value that I put in session that I check for to see if the user is logged in/that they have been authenticated. The value is only put in after all authentication.
My question is it there an easy way to intergrate this into my application ? That is to say would it be possible to subclass action and place this test in it and then change all my actions to extend my newly subclassed Action class ? Or would it be better to simply place all of these tests in each Action (this seems quite ugly and does not make good code re-use at all )

I am open to any other suggestions or ideas that anyone might be able to give.

thanks in advance.
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What servlet engine or application server are you using? On my current project this is all handled by Oracle Application Server and I am pretty sure that WebSphere handled this on previous projects.

- Brent
 
A knibbs
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am on Sun's application server.
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Extend the RequestProcessor class and override the processPreprocess method to check if the session is valid. If not valid redirect to the Login Page.

Hope this helps.

Thanks and Regards,
Arul.
 
A knibbs
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the suggestion, but I had actually tried that and it didn't seem to work. I couldn't even get a test message to appear in my logs. Is there anything else that one has to do other than extend RequestProcessor ?
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about using a Filter and adding the check in the filter?
[ March 06, 2007: Message edited by: Jaikiran Pai ]
 
A knibbs
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To be honest I know nothing about filters yet, so perhaps I will put that on the list of things to be done in the future.

As always thanks for the suggestion.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
overriding the RequestProcessor is the correct way, i don't know why its not working for you.

because i implemented the same in one of my projects.

after doing all those thigs have you made the entry of your new request processor in the struts_config file?

if you are missing that thats the reason.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic