You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jadeler <ja...@yahoo.ca> on 2005/10/17 06:27:48 UTC
Handling invalid sessions
What is the best way to handle invalid sessions (http
sessions) within Struts? I need a way to determine
when an object within a session no longer exists and
redirect the user to an error page when that happens.
I was thinking of implementing
HttpSessionAttributeListener or a Servlet filter. Any
suggestions on whats recommended? Thanks.
Jadeler
__________________________________________________________
Find your next car at http://autos.yahoo.ca
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Handling invalid sessions
Posted by Jadeler <ja...@yahoo.ca>.
Thanks for the suggestions. I'll try them out.
Cheers,
Jadeler
--- Aladin Alaily <st...@aladin.ca> wrote:
> Hi Jadeler,
>
> In response to your question about managing session
> objects, I would
> propose two methods:
>
> 1) Write a CustomRequestProcessor (which extends the
> struts
> RequestProcessor), and put your management code in
> there. As a struts
> programmer, you know that all requests *should* go
> through this
> processor. This way, if you (or someone else)
> forgets to extend a base
> class (as was suggested in another post), your
> validation still takes place.
>
> 2) Write a filter as you suggested. Plain and
> simple. The advantage of
> the filter is that it is not struts dependent and it
> can be mapped to
> specific urls. Consequently, not all requests will
> pass through the
> filter (unless you specify the map as '/').
>
> Good Luck.
> Aladin
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
>
>
__________________________________________________________
Find your next car at http://autos.yahoo.ca
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Handling invalid sessions
Posted by Aladin Alaily <st...@aladin.ca>.
Hi Jadeler,
In response to your question about managing session objects, I would
propose two methods:
1) Write a CustomRequestProcessor (which extends the struts
RequestProcessor), and put your management code in there. As a struts
programmer, you know that all requests *should* go through this
processor. This way, if you (or someone else) forgets to extend a base
class (as was suggested in another post), your validation still takes place.
2) Write a filter as you suggested. Plain and simple. The advantage of
the filter is that it is not struts dependent and it can be mapped to
specific urls. Consequently, not all requests will pass through the
filter (unless you specify the map as '/').
Good Luck.
Aladin
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Handling invalid sessions
Posted by ra...@tcs.com.
That is why i have clearly specified that you have to implement an
abstract method in the base class. which will be implemented in all your
classes and that method will be called explicitly from Base Action class.
You should not override the execute() method in the Child classes.
Regards,
Rajasekhar Cherukuri
peru cheppanu <st...@yahoo.com>
10/17/2005 10:26 AM
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>
To
Struts Users Mailing List <us...@struts.apache.org>
cc
Subject
Re: Handling invalid sessions
If we do that, then execute() method in child classes will override Base
Action execute() method. Right? Then, as far as I know, that execute() in
Base Action will not be executed..
Peru Cheppanu
rajasekhar.cherukuri@tcs.com wrote:
Hi,
The best way is to write a Base Action class and extend that class
for all your Action classes in your application. Place a check in the
execute method of the Base Action class and if it is a "success" then call
an abstract method in the Base Action class which will be implemented by
all your Action classes. If it is a "failure" (means there is NO required
information in the session), then forward to a login page or failure page.
Regards,
Rajasekhar Cherukuri
Jadeler
10/17/2005 09:57 AM
Please respond to
"Struts Users Mailing List"
To
user@struts.apache.org
cc
Subject
Handling invalid sessions
What is the best way to handle invalid sessions (http
sessions) within Struts? I need a way to determine
when an object within a session no longer exists and
redirect the user to an error page when that happens.
I was thinking of implementing
HttpSessionAttributeListener or a Servlet filter. Any
suggestions on whats recommended? Thanks.
Jadeler
__________________________________________________________
Find your next car at http://autos.yahoo.ca
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
ForwardSourceID:NT0000615A
Notice: The information contained in this e-mail message and/or
attachments to it may contain confidential or privileged information. If
you are not the intended recipient, any dissemination, use, review,
distribution, printing or copying of the information contained in this
e-mail message and/or attachments to it are strictly prohibited. If you
have received this communication in error, please notify us by reply
e-mail or telephone and immediately and permanently delete the message and
any attachments. Thank you
---------------------------------
Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
ForwardSourceID:NT0000616E
Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
Re: Handling invalid sessions
Posted by peru cheppanu <st...@yahoo.com>.
If we do that, then execute() method in child classes will override Base Action execute() method. Right? Then, as far as I know, that execute() in Base Action will not be executed..
Peru Cheppanu
rajasekhar.cherukuri@tcs.com wrote:
Hi,
The best way is to write a Base Action class and extend that class
for all your Action classes in your application. Place a check in the
execute method of the Base Action class and if it is a "success" then call
an abstract method in the Base Action class which will be implemented by
all your Action classes. If it is a "failure" (means there is NO required
information in the session), then forward to a login page or failure page.
Regards,
Rajasekhar Cherukuri
Jadeler
10/17/2005 09:57 AM
Please respond to
"Struts Users Mailing List"
To
user@struts.apache.org
cc
Subject
Handling invalid sessions
What is the best way to handle invalid sessions (http
sessions) within Struts? I need a way to determine
when an object within a session no longer exists and
redirect the user to an error page when that happens.
I was thinking of implementing
HttpSessionAttributeListener or a Servlet filter. Any
suggestions on whats recommended? Thanks.
Jadeler
__________________________________________________________
Find your next car at http://autos.yahoo.ca
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
ForwardSourceID:NT0000615A
Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
---------------------------------
Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
Re: Handling invalid sessions
Posted by ra...@tcs.com.
Hi,
The best way is to write a Base Action class and extend that class
for all your Action classes in your application. Place a check in the
execute method of the Base Action class and if it is a "success" then call
an abstract method in the Base Action class which will be implemented by
all your Action classes. If it is a "failure" (means there is NO required
information in the session), then forward to a login page or failure page.
Regards,
Rajasekhar Cherukuri
Jadeler <ja...@yahoo.ca>
10/17/2005 09:57 AM
Please respond to
"Struts Users Mailing List" <us...@struts.apache.org>
To
user@struts.apache.org
cc
Subject
Handling invalid sessions
What is the best way to handle invalid sessions (http
sessions) within Struts? I need a way to determine
when an object within a session no longer exists and
redirect the user to an error page when that happens.
I was thinking of implementing
HttpSessionAttributeListener or a Servlet filter. Any
suggestions on whats recommended? Thanks.
Jadeler
__________________________________________________________
Find your next car at http://autos.yahoo.ca
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
ForwardSourceID:NT0000615A
Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you