Slide 1

Slide 1 text

Kapsch Group Managing user’s session with Spring Session Vedran Pavić, Kapsch CarrierCom d.o.o.

Slide 2

Slide 2 text

Kapsch Group About the Author  Software Development Engineer at Kapsch CarrierCom d.o.o. since 2011  Developing solutions in Telco industry, primarily related to Number Portability  An active contributor in open-source community (mostly Spring related projects) Managing user’s session with Spring Session | JavaCRO '16 2

Slide 3

Slide 3 text

Kapsch Group Servlet HttpSession  Easy to use – leads to abuse/misuse  Hard to scale  Clustering is container specific, often requires multicast  Stateless architecture – is it always possible? Managing user’s session with Spring Session | JavaCRO '16 3

Slide 4

Slide 4 text

Kapsch Group Enter Spring Session  A Servlet HttpSession wrapper  Container agnostic – configure once, use everywhere   Provides strategy for storing sessions – proxies Servlet HttpSession to the backing store  Does not necessarily require Spring Managing user’s session with Spring Session | JavaCRO '16 4

Slide 5

Slide 5 text

Kapsch Group Polyglot Session Persistence  Pluggable implementations for session store  Initial release (1.0) provided Redis and java.util.Map backed stores  Release 1.1 added explicit support for Hazelcast and Gemfire  Release 1.2 (scheduled for May 2016) will add support for JDBC and MongoDB Managing user’s session with Spring Session | JavaCRO '16 5

Slide 6

Slide 6 text

Kapsch Group Basic Demo Managing user’s session with Spring Session | JavaCRO '16 6

Slide 7

Slide 7 text

Kapsch Group HttpSessionStrategy  Correlating the stored session to the HTTP client  Cookie based strategy – bye-bye JSESSIONID   HTTP header based strategy – RESTful APIs Managing user’s session with Spring Session | JavaCRO '16 7

Slide 8

Slide 8 text

Kapsch Group Session Strategy Demo Managing user’s session with Spring Session | JavaCRO '16 8

Slide 9

Slide 9 text

Kapsch Group Session Switching  Support for multiple sessions in a single browser  HttpSessionManager provides support for handling session aliases and encoding URL’s  Uses cookie for correlating sessions and aliases Managing user’s session with Spring Session | JavaCRO '16 9

Slide 10

Slide 10 text

Kapsch Group Session Switching Demo Managing user’s session with Spring Session | JavaCRO '16 10

Slide 11

Slide 11 text

Kapsch Group WebSockets  WebSockets and HTTP Session – no easy way to keep the Session alive  Spring Session provides interceptors to transparently integrate with Spring’s WebSocket support Managing user’s session with Spring Session | JavaCRO '16 11

Slide 12

Slide 12 text

Kapsch Group WebSockets Demo Managing user’s session with Spring Session | JavaCRO '16 12

Slide 13

Slide 13 text

Kapsch Group Other Features  HttpSessionListener – translates Spring Session events into HttpSessionEvent (provided session store supports it)  FindByIndexNameSessionRepository – allows retrieval of all sessions for the given user  Custom session serialization (most session stores) Managing user’s session with Spring Session | JavaCRO '16 13

Slide 14

Slide 14 text

Kapsch Group Resources  Project page: http://projects.spring.io/spring-session/  Issue tracker: https://github.com/spring-projects/spring-session/issues  Source code: https://github.com/spring-projects/spring-session  Sample project: https://github.com/vpavic/javacro16-spring-session Managing user’s session with Spring Session | JavaCRO '16 14

Slide 15

Slide 15 text

Kapsch Group Questions Managing user’s session with Spring Session | JavaCRO '16 15

Slide 16

Slide 16 text

Kapsch Group Vedran Pavić [email protected] https://www.kapsch.net/hr/kcc https://github.com/vpavic Managing user’s session with Spring Session | JavaCRO '16 16