You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by John Fitzpatrick <jo...@vitarara.net> on 2004/10/15 16:54:18 UTC

HttpServletRequest Question

This may be slightly off-topic for this list, but here goes anyway:

I'm working on a Struts site which must be i18n compatible and have a login
system where some of the pages are protected. What I'm looking to accomplish
is two fold:

1. When viewing any page, including query results, be able to select a
language from the pull-down menu and get the page the same page back in the
new language.

2. When requesting a page that is protected, have the user be prompted to
authenticate and then receive the originally requested page. Or, have a
login form on each page which will return the same page with just the login
details changed.

To accomplish this, I attempted to store each HttpServletRequest in the
session and then check for a language change, or login request, in an
ancestor of each action, process that change and then serve the previous
request. However, when I take the stored request out of the session, it's
handle to the Session is now 'null.'

Has anyone had some experience attempting something like this, or am I
barking up entirely the wrong tree here?

FWIW, I've looked at JAAS and don't feel that it suits our needs. The role
handling is simply too coarse. 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Checking for presence of specific error message

Posted by Frank Burns <fr...@the-hub.demon.co.uk>.
Is there any way of checking for the presence of a SPECIFIC error message in
the error queue?

Thanks,

Frank.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: HttpServletRequest Question

Posted by John Fitzpatrick <jo...@vitarara.net>.
Thanks for the response.

I was doing some more thinking about this after posting the question -- What
I really need is the request parameters to be preserved. As I'm using
DynaActionForms, I think I could just store a copy of the form after each
request; and, then if I intercept a login/language change, simply substitute
the stored form for the submitted one. Obviously I'd need to ensure that the
form is for the page being requested now, but I think that should work. Any
problems you see?


On 20041015 11:17 AM, "Kris Schneider" <kr...@dotech.com> wrote:

> As to storing the request instances, here's something of interest from the
> Servlet 2.3 spec:
> 
> ===
> SRV.4.10 Lifetime of the Request Object
> Each request object is valid only within the scpoe of a servlet’s service
> method, or within the scope of a filter’s doFilter method. Containers commonly
> recycle request objects in order to avoid the performance overhead of request
> object creation. The developer must be aware that maintaining references to
> request objects outside the scope described above may lead to
> non-deterministic
> behavior.
> ===
> 
> You can certainly pull some data out of the request (params, properties, etc.)
> and store that, but do not maintain a reference to the actual request object.
> 
> Quoting John Fitzpatrick <jo...@vitarara.net>:
> 
>> This may be slightly off-topic for this list, but here goes anyway:
>> 
>> I'm working on a Struts site which must be i18n compatible and have a login
>> system where some of the pages are protected. What I'm looking to accomplish
>> is two fold:
>> 
>> 1. When viewing any page, including query results, be able to select a
>> language from the pull-down menu and get the page the same page back in the
>> new language.
>> 
>> 2. When requesting a page that is protected, have the user be prompted to
>> authenticate and then receive the originally requested page. Or, have a
>> login form on each page which will return the same page with just the login
>> details changed.
>> 
>> To accomplish this, I attempted to store each HttpServletRequest in the
>> session and then check for a language change, or login request, in an
>> ancestor of each action, process that change and then serve the previous
>> request. However, when I take the stored request out of the session, it's
>> handle to the Session is now 'null.'
>> 
>> Has anyone had some experience attempting something like this, or am I
>> barking up entirely the wrong tree here?
>> 
>> FWIW, I've looked at JAAS and don't feel that it suits our needs. The role
>> handling is simply too coarse. 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: HttpServletRequest Question

Posted by Kris Schneider <kr...@dotech.com>.
As to storing the request instances, here's something of interest from the
Servlet 2.3 spec:

===
SRV.4.10 Lifetime of the Request Object
Each request object is valid only within the scpoe of a servlet’s service
method, or within the scope of a filter’s doFilter method. Containers commonly
recycle request objects in order to avoid the performance overhead of request
object creation. The developer must be aware that maintaining references to
request objects outside the scope described above may lead to non-deterministic
behavior.
===

You can certainly pull some data out of the request (params, properties, etc.)
and store that, but do not maintain a reference to the actual request object.

Quoting John Fitzpatrick <jo...@vitarara.net>:

> This may be slightly off-topic for this list, but here goes anyway:
> 
> I'm working on a Struts site which must be i18n compatible and have a login
> system where some of the pages are protected. What I'm looking to accomplish
> is two fold:
> 
> 1. When viewing any page, including query results, be able to select a
> language from the pull-down menu and get the page the same page back in the
> new language.
> 
> 2. When requesting a page that is protected, have the user be prompted to
> authenticate and then receive the originally requested page. Or, have a
> login form on each page which will return the same page with just the login
> details changed.
> 
> To accomplish this, I attempted to store each HttpServletRequest in the
> session and then check for a language change, or login request, in an
> ancestor of each action, process that change and then serve the previous
> request. However, when I take the stored request out of the session, it's
> handle to the Session is now 'null.'
> 
> Has anyone had some experience attempting something like this, or am I
> barking up entirely the wrong tree here?
> 
> FWIW, I've looked at JAAS and don't feel that it suits our needs. The role
> handling is simply too coarse. 

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org