如何在 shiro 中获取原始请求 URL

How to get original request URL in shiro

我使用 org.apache.shiro.web.servlet.ShiroFilter 并根据我 shiro.ini

中的配置 authc.loginUrl = /login.jsp 重定向到 login.jsp

如何在login.jsp

中获取原始请求URL

PS:
假设我的 url 是 localhost:8080/myApp/i.html 现在它重定向到 login.jsp

我有用于登录的 ExtJs 应用程序,在成功验证后我想重定向回 i.html 实际请求的 URL 用户。

您可以使用 shiro 的 WebUtils class 来获取这样的原始请求

WebUtils.getAndClearSavedRequest(request)