Glad to help!
On Thu, Apr 12, 2012 at 12:26 AM, Marcus Bond <[email protected]> wrote: > Thanks Les, this works a treat. I had used WebUtils to obtain the request url > and returned that as a redirect to Spring minus the context root but this is > much cleaner.. I had never had a reason to return null in a Spring controller > and didn’t even know you could so double points for the answer :) > > Thanks, > Marcus. > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On > Behalf Of Les Hazlewood > Sent: 12 April 2012 06:18 > To: [email protected] > Subject: Re: Saved Request using PassThruAuthenticationFilter and Spring > Controller > > Hi Marcus, > > Use the following from within your Spring MVC controller: > > import org.apache.shiro.web.util.WebUtils; > ... > String fallbackUrl = "/path/to/go/to/incase/there/is/no/saved/request"; > WebUtils.redirectToSavedRequest(request, response, fallbackUrl); return null; > //tell Spring MVC not to render a view, we're redirecting explicitly > > HTH, > > -- > Les Hazlewood > CTO, Stormpath | http://www.stormpath.com | 888.391.5282 > twitter: @lhazlewood | http://twitter.com/lhazlewood > blog: http://leshazlewood.com > stormpath blog: http://www.stormpath.com/blog/ > > On Wed, Apr 11, 2012 at 3:29 AM, Marcus Bond <[email protected]> wrote: >> Hi, >> >> >> >> I have a Spring MVC web application configured such that in web.xml my >> shiroFilter is a org.springframework.web.filter.DelegatingFilterProxy >> and the shiroFilter bean is >> org.apache.shiro.spring.web.ShiroFilterFactoryBean. >> I use a shiro filter called authc which is a >> org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter >> configured via the factory bean to have loginUrl of /login which is a >> Spring Controller. >> >> >> >> What this means in English is that I have configured Shiro to delegate >> login to a Spring Controller and all is working fine. However, I now >> need to add the capability to remember a requested URL and redirect to >> that if the user first had to authenticate. Shiro already supports >> this and the PassThruAuthenticationFilter saves the request but what I >> want to know is how I can make use of the Shiro functionality to >> easily redirect the user to their originally requested URL upon a >> successful login from within the code of my controller. >> >> >> >> Cheers, >> >> Marcus. >> >> >
