struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam J Samere <asam...@rochester.rr.com>
Subject Re: How do I get the original RequestURI?
Date Sun, 10 Sep 2006 16:19:27 GMT
You didn't mention what you were trying to do was login related. You 
*could* render the target (original) URL as an input parameter in the 
generated markup when redirecting to the login page. Is there a reason 
you can't use the standard J2EE security and login configuration? This 
does exactly what you are trying to do, and handles checking whether the 
user is logged in, has the correct roles etc. for you.

Adam

David Grundberg wrote:
> He, I'm using Struts 1.2.7, and it's not there. :( Too bad for me. 
> However, I think my problem must have been solved in some way, because 
> what I'm trying to do isn't that remarkable.
>
> Some actions require the user to be logged in. I want to direct them 
> to a login screen. When they successfully logged in, I want  to return 
> to where they came from. Is the only option to *redirect* to the login 
> action and use the HTTP Referer-header to save where they came from? 
> (Or send the returnurl as a GET-parameter to the login action)
>
> I guess action chaining is kind of evil. Hey, it's not like there is 
> any actual, factual documentation about struts out there waiting for 
> me to find it? I'm having a very hard time finding any hints how to 
> accomplish things.
>
> Adam J Samere skrev:
>> 1.2 does not have this behavior. You could either use a filter as I 
>> mentioned, or to stay within the struts framework either create a 
>> common base Action subclass, or subclass RequestProcessor or 
>> ActionMapping to add the desired functionality. Either way would be a 
>> trivial task. I agree with Don, action chaining is bad! :)
>>
>> Don Brown wrote:
>>> Well, first of all, action chaing is bad ;), but second, Struts 1.3 at
>>> least, and perhaps 1.2 automatically saves the original request uri
>>> for you.  Look in the request under the
>>> o.a.struts.Globals.ORIGINAL_REQUEST_URI key.
>>>
>>> Don
>>>
>>> On 9/10/06, David Grundberg <c04dgg@cs.umu.se> wrote:
>>>> You are absolutely right about that, I could modify PlaceAction to 
>>>> save
>>>> the URL somewhere. But you see, I'm doing a lot of forwarding to the
>>>> ListAction, and I don't want to change every Action that forwards to
>>>> ListAction. Come on! There's got to be a way to find the original URL.
>>>>
>>>> Adam J Samere skrev:
>>>> > You could call getRequestURI in PlaceAction and set the result 
>>>> into a
>>>> > request attribute (assuming PlaceAction forwards to list.do, not a
>>>> > redirect) which would then be available to ListAction. If you are
>>>> > redirecting you would need to either set the value into the session,
>>>> > or append it as a request parameter to list.do. Not sure if there 
>>>> is a
>>>> > better way though.
>>>> >
>>>> > Adam
>>>> >
>>>> > David Grundberg wrote:
>>>> >> Hi,
>>>> >>
>>>> >> I want to do something like this:
>>>> >> 1. User enters http://localhost/appname/welcome.do
>>>> >> 2. PlaceAction forwards to list.do
>>>> >> 3. In ListAction, I want to retrieve the URL the user entered
>>>> >> "/appname/welcome.do".
>>>> >>
>>>> >> The problem: when I run getRequestURI in the ListAction, all I 
>>>> get is
>>>> >> "/appname/list.do". I guess this is a sort of natural thing for

>>>> it to
>>>> >> do, but how do I get the original URI? (/appname/welcome.do)
>>>> >>
>>>> >> Any help appreciated!
>>>> >>
>>>> >> 
>>>> ---------------------------------------------------------------------
>>>> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> >> For additional commands, e-mail: user-help@struts.apache.org
>>>> >>
>>>> >>
>>>> >
>>>> >
>>>> >
>>>> > 
>>>> ---------------------------------------------------------------------
>>>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> > For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



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


Mime
View raw message