use of org.springframework.session.MapSessionRepository in project spring-session by spring-projects.
the class SessionRepositoryFilterTests method doFilterLazySessionCreation.
@Test
public void doFilterLazySessionCreation() throws Exception {
SessionRepository<MapSession> sessionRepository = spy(new MapSessionRepository(new ConcurrentHashMap<>()));
this.filter = new SessionRepositoryFilter<>(sessionRepository);
doFilter(new DoInFilter() {
@Override
public void doFilter(HttpServletRequest wrappedRequest, HttpServletResponse wrappedResponse) throws IOException {
}
});
verifyZeroInteractions(sessionRepository);
}
use of org.springframework.session.MapSessionRepository in project spring-boot by spring-projects.
the class SessionAutoConfigurationTests method hashMapSessionStoreCustomTimeout.
@Test
public void hashMapSessionStoreCustomTimeout() {
load("spring.session.store-type=hash-map", "server.session.timeout=3000");
MapSessionRepository repository = validateSessionRepository(MapSessionRepository.class);
assertThat(getSessionTimeout(repository)).isEqualTo(3000);
}
use of org.springframework.session.MapSessionRepository in project spring-session by spring-projects.
the class IndexDocTests method repositoryDemo.
@Test
public void repositoryDemo() {
RepositoryDemo<MapSession> demo = new RepositoryDemo<>();
demo.repository = new MapSessionRepository(new ConcurrentHashMap<>());
demo.demo();
}
use of org.springframework.session.MapSessionRepository in project spring-session by spring-projects.
the class IndexDocTests method expireRepositoryDemo.
// end::repository-demo[]
@Test
public void expireRepositoryDemo() {
ExpiringRepositoryDemo<MapSession> demo = new ExpiringRepositoryDemo<>();
demo.repository = new MapSessionRepository(new ConcurrentHashMap<>());
demo.demo();
}
use of org.springframework.session.MapSessionRepository in project spring-session by spring-projects.
the class Initializer method contextInitialized.
@Override
public void contextInitialized(ServletContextEvent sce) {
this.instance = createHazelcastInstance();
Map<String, Session> sessions = this.instance.getMap(SESSION_MAP_NAME);
MapSessionRepository sessionRepository = new MapSessionRepository(sessions);
SessionRepositoryFilter<? extends Session> filter = new SessionRepositoryFilter<>(sessionRepository);
Dynamic fr = sce.getServletContext().addFilter("springSessionFilter", filter);
fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/*");
}
Aggregations