Search code examples
shiro

How to get original request URL in shiro


I use org.apache.shiro.web.servlet.ShiroFilter and it redirects to login.jsp as per configuration authc.loginUrl = /login.jsp in my shiro.ini

How to get the original request URL in the login.jsp

PS:
Say my url was localhost:8080/myApp/i.html now it redirects to login.jsp

I have ExtJs app for login and after successful authentication i want to redirect back to i.html the URL user actually requested for.


Solution

  • You can use WebUtils class of shiro to get original request like this

    WebUtils.getAndClearSavedRequest(request)