This question is the needs encountered when you log in to the registration module before. How can users directly access the login page and can control the directly jump to the homepage, but if the user does not log in to the shopping cart, the shopping cart Because the session timeout, the user needs to log in again, then the previous page jumping back to the previous page is what improves the user experience. The better way to implement this function is to log in by AJAX, so that the pop -up window can be logged in directly on the current page pop -up window. A URL. Let me share with you through a piece of code:
The project integrates Shiro, which has such a function to prevent the Webutils tools.
With so much nonsense, in fact, some people have written such a blog post on this function. This Shiro tutorial written by God is also worth watching, but I am using
Savedrequest Savedrequest = Webutils.getsavedRequest (Request); then, the SaveDrequest object has been empty for a while, and he encountered a high guidance in the group later, found that his configuration file was not written well, that is, the Filterc in Shirofilter in Shirofilter haindefinitions, where The URL that needs to be intercepted is not completely written, like the configuration below
<!-Shiro's web filter-> <bean id = "shirofilter"> <property name = "securityManager" ref = "securityManager" /> <property name = "loginurl" = " /c OOKA-User-Web /> /> /> <property name = "unauthorizedUrl" value = " /unauthorized" /> <property name = "Filters"> <util: Map> <Entry Key = "Authc"> <ben /> /entry> < /Util: Map> </Property> <Property name = "FilterChaindefinitions"> <Value> # files that can be accessed without authentication are placed in the front/js/* = anon/css/* = amg/* = Anon /iMages/* = Anon/User-WEB/LOGIN = Anon/logout = logout/user-weight/* = Authc/Backend-WEB/* = AUTHC </value> </bean> </bean>
Only/user-web/* (Except login, the short-circuit mechanism of the URL matches here, that is, the first matching principle) and the URL behind/back-weight When logging in, when you visit the above two link prefixes, you will jump to the previous interface after the login is successful.
The above content is introduced in this article, I hope to help everyone