Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring tutorial on Session Management

I want to learn how session management is being done in Spring web MVC. Do you know any free tutorial on how is it being done?

I am thinking of similar sample applicatin such as BookStore or Shopping cart applications that I have done using basic servlets and JSP.

Kindly advise me how is it done and make it done the proper way in Spring Framework.

Thanks to all.

like image 950
Rex Mercardo Avatar asked Dec 28 '09 09:12

Rex Mercardo


People also ask

How does spring manage session?

Spring Session has the simple goal of free up session management from the limitations of the HTTP session stored in the server. The solution makes it easy to share session data between services in the cloud without being tied to a single container (i.e. Tomcat).

What is session management in spring MVC?

Session management is one of essential parts for each web application. Since Spring MVC is a powerfull framework for a web development, it has own tools and API for the interaction with sessions. Today I intend to show you basic ways of session processing within Spring MVC application.

What are the different sessions in spring?

Spring Session consists of the following modules: Spring Session Core - provides core Spring Session functionalities and APIs. Spring Session Data Redis - provides SessionRepository and ReactiveSessionRepository implementation backed by Redis and configuration support.


2 Answers

Use this filters to your purpose. Just extend the below mentioned HiddenHttpMethodFilter and write your own filter.

This class will be called for each request as pattern is given as /* . In this class redirect it to your logout controller.

<filter>
  <filter-name>httpMethodFilter</filter-name>
  <filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>httpMethodFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>
like image 98
Manoj Pradhan Avatar answered Nov 22 '22 06:11

Manoj Pradhan


You might take a look at Spring Security: http://static.springsource.org/spring-security/site/

like image 35
ustun Avatar answered Nov 22 '22 05:11

ustun