aspose file tools*
The moose likes Struts and the fly likes Extending RequestProcessor for Session Management Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Extending RequestProcessor for Session Management" Watch "Extending RequestProcessor for Session Management" New topic
Author

Extending RequestProcessor for Session Management

Suresh Gopi
Ranch Hand

Joined: Mar 08, 2007
Posts: 49
Hello Friends,

I have few doubts regarding Session management.

I'm planning to extend RequestProcessor class to know whether session is expired or not. (Instead of doing it in every action class)


I want to know how to differentiate the new request from the 'session-expired*' request

'session-expired' request : request that is made after session-timeout.

Because for both type of requests session.getSession(true) will return new Session objects.

I need to display same page for both type of requests but with a message for 'session-expired' request.



Note: My problem is NOT about differentiating new requests from subsequent requests (which is part of the existing session)
I can accomplish it by addding an object to the session intially and look for the object to know whether the request is part of exisitng session or not.


Hope my question is clear. If not, please let me know.

[ December 05, 2008: Message edited by: Suresh Gopi ]
[ December 05, 2008: Message edited by: Suresh Gopi ]

Regards<br />Suresh
Suresh Gopi
Ranch Hand

Joined: Mar 08, 2007
Posts: 49
Hello friends,

Any inputs on this?

Thanks.
Tom Rispoli
Ranch Hand

Joined: Aug 29, 2008
Posts: 349
Can you clarify this a little more? I'm not sure how you're using this 'session-expired' request. What is your process flow for generating this request? When is the new Session created in relation to it?
Suresh Gopi
Ranch Hand

Joined: Mar 08, 2007
Posts: 49
Actually i wanted to differentiate the very first request from subsequent requests which are not part of the existing session to the application.

The problem was i wanted to do this check in class which is a subclass of RequestProcessor.

By 'session-expired request' i meant the request sent to Server App by the browser after the current page's session timeout.

I solved it. i'm justusing request.getServletPath() to know the action path name from that i determine whether the request is for the starting page of application or other pages.

if it is for other pages the request should be associated with session, i'll retrieve the session associated with the request and check for the object that i stored initially after i created my new Session.

If it is present then i assume the request is not STALE otherwise it is expired.

Thanks for your time Tom.
[ December 08, 2008: Message edited by: Suresh Gopi ]
 
jQuery in Action, 2nd edition
 
subject: Extending RequestProcessor for Session Management