wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts and Tiles issue: how to get the request  URL ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts and Tiles issue: how to get the request  URL ?" Watch "Struts and Tiles issue: how to get the request  URL ?" New topic
Author

Struts and Tiles issue: how to get the request URL ?

Reghu Ram Thanumalayan
Ranch Hand

Joined: Oct 21, 2003
Posts: 193
Hello All,
I have a Spring + Struts web application and I am using the Spring Acegi for user authentication. I have a login link in a jsp which is embedded into in a base tile and this link appears on all pages in the webapp.

My original problem was to redirect the user to the same page where he was in, after successful login. With Acegi, i had to override the successfulAuthentication method in the AuthenticationProcessingFilter to retrieve the requestUrl from the session attribute and redirect to this url after successful login.

I tried setting the original request url in my user login jsp and also in the Struts Action for the userlogin. But the problem is, i am not able to get the original request url (the one which is displayed in the address bar of the browser) with the request.getRequestURL method because this method returns the url of the base tile.

I already did a lot of searching for this topic, found some solutions discussed, but they require changing all the actions that could be invoked from the webapp, to store the request url into the session attribute

This looks like a common issue for webapps which want to redirect the user to the page he was in previously before logging in. Is there a easy solution to this problem?

Regards,
Reghu


Cheers,<br />Reghu Ram T<br /> <br />SCJP 1.4 - 98 %, SCBCD 1.3 - 94 %, SCMAD 1.0 - 92 %
Nag Bussa
Greenhorn

Joined: Nov 14, 2007
Posts: 6
----------
I tried setting the original request url in my user login jsp and also in the Struts Action for the userlogin. But the problem is, i am not able to get the original request url (the one which is displayed in the address bar of the browser) with the request.getRequestURL method because this method returns the url of the base tile.
------------

Did you try using the following code instead of request.getRequestURL


This path gives original url in browser instead of the url of the base tile.
-----
I already did a lot of searching for this topic, found some solutions discussed, but they require changing all the actions that could be invoked from the webapp, to store the request url into the session attribute
---------

Yes. This requires changing all the action classes. you need to get this path in each action class and set this in either request or session...but I faced problem with setting in session and browser back button..

Thanks,
Nag.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts and Tiles issue: how to get the request URL ?
 
Similar Threads
Struts2 : Forwarding to the requested page after login
Acegi problems with mod_rewrite
forward & come back
Session swapping problem under load
Original request referer in Action/Interceptor