In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
What this article shares with you is about how to analyze the single sign-on implementation in the same domain of springsession. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article. Let's take a look at it.
Session session Management
In Web project development, Session session management is a very important part, which is used to store and record user status or related data. Usually, session is entrusted to the container (tomcat) for storage and management, but if the project is deployed in multiple tomcat, there are great problems with session management.
1. Session cannot be shared among multiple tomcat. For example, the user has logged in on the tomcat A server, but when the load balancer jumps to tomcat B, the session expires because the tomcat B server does not have the user's login information, and the user logs out.
2. Once the tomcat container is closed or restarted, the session session will also become invalid; therefore, if the project is deployed in multiple tomcat, the problem of session sharing needs to be solved.
Configuration file
Pom.xml
Org.springframework.session
Spring-session-data-redis
1.3.1.RELEASE
Web.xml
SpringSessionRepositoryFilter
Org.springframework.web.filter.DelegatingFilterProxy
SpringSessionRepositoryFilter
* .do
Org.springframework.web.context.ContextLoaderListener
ContextConfigLocation
Classpath:applicationContext.xml
ApplicationContext.xml
Code testing
Public class SessionServlet extends HttpServlet {
Protected void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {this.doGet (request,response)
} protected void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {String sesssionID = request.getSession () .getId ()
/ / deploy two copies and change this place from 8081 to 8080, just to distinguish between response.getWriter (). Write ("8081 Server SessionID" + sesssionID);}}
The above is how to parse the implementation of single sign-on in the same domain of springsession. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.