org.springframework.web.server.session.WebSessionManager Java Examples
The following examples show how to use
org.springframework.web.server.session.WebSessionManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringWebSessionConfigurationTests.java From spring-session with Apache License 2.0 | 6 votes |
@Test void enableSpringWebSessionConfiguresThings() { this.context = new AnnotationConfigApplicationContext(); this.context.register(GoodConfig.class); this.context.refresh(); WebSessionManager webSessionManagerFoundByType = this.context.getBean(WebSessionManager.class); Object webSessionManagerFoundByName = this.context.getBean(WebHttpHandlerBuilder.WEB_SESSION_MANAGER_BEAN_NAME); assertThat(webSessionManagerFoundByType).isNotNull(); assertThat(webSessionManagerFoundByName).isNotNull(); assertThat(webSessionManagerFoundByType).isEqualTo(webSessionManagerFoundByName); assertThat(this.context.getBean(ReactiveSessionRepository.class)).isNotNull(); }
Example #2
Source File: DefaultServerWebExchange.java From spring-analysis-note with MIT License | 6 votes |
DefaultServerWebExchange(ServerHttpRequest request, ServerHttpResponse response, WebSessionManager sessionManager, ServerCodecConfigurer codecConfigurer, LocaleContextResolver localeContextResolver, @Nullable ApplicationContext applicationContext) { Assert.notNull(request, "'request' is required"); Assert.notNull(response, "'response' is required"); Assert.notNull(sessionManager, "'sessionManager' is required"); Assert.notNull(codecConfigurer, "'codecConfigurer' is required"); Assert.notNull(localeContextResolver, "'localeContextResolver' is required"); // Initialize before first call to getLogPrefix() this.attributes.put(ServerWebExchange.LOG_ID_ATTRIBUTE, request.getId()); this.request = request; this.response = response; this.sessionMono = sessionManager.getSession(this).cache(); this.localeContextResolver = localeContextResolver; this.formDataMono = initFormData(request, codecConfigurer, getLogPrefix()); this.multipartDataMono = initMultipartData(request, codecConfigurer, getLogPrefix()); this.applicationContext = applicationContext; }
Example #3
Source File: DefaultServerWebExchange.java From java-technology-stack with MIT License | 6 votes |
DefaultServerWebExchange(ServerHttpRequest request, ServerHttpResponse response, WebSessionManager sessionManager, ServerCodecConfigurer codecConfigurer, LocaleContextResolver localeContextResolver, @Nullable ApplicationContext applicationContext) { Assert.notNull(request, "'request' is required"); Assert.notNull(response, "'response' is required"); Assert.notNull(sessionManager, "'sessionManager' is required"); Assert.notNull(codecConfigurer, "'codecConfigurer' is required"); Assert.notNull(localeContextResolver, "'localeContextResolver' is required"); // Initialize before first call to getLogPrefix() this.attributes.put(ServerWebExchange.LOG_ID_ATTRIBUTE, request.getId()); this.request = request; this.response = response; this.sessionMono = sessionManager.getSession(this).cache(); this.localeContextResolver = localeContextResolver; this.formDataMono = initFormData(request, codecConfigurer, getLogPrefix()); this.multipartDataMono = initMultipartData(request, codecConfigurer, getLogPrefix()); this.applicationContext = applicationContext; }
Example #4
Source File: SpringWebSessionConfiguration.java From spring-session with Apache License 2.0 | 5 votes |
/** * Configure a {@link WebSessionManager} using a provided * {@link ReactiveSessionRepository}. * @param repository a bean that implements {@link ReactiveSessionRepository}. * @return a configured {@link WebSessionManager} registered with a preconfigured * name. */ @Bean(WebHttpHandlerBuilder.WEB_SESSION_MANAGER_BEAN_NAME) public WebSessionManager webSessionManager(ReactiveSessionRepository<? extends Session> repository) { SpringSessionWebSessionStore<? extends Session> sessionStore = new SpringSessionWebSessionStore<>(repository); DefaultWebSessionManager manager = new DefaultWebSessionManager(); manager.setSessionStore(sessionStore); if (this.webSessionIdResolver != null) { manager.setSessionIdResolver(this.webSessionIdResolver); } return manager; }
Example #5
Source File: AbstractMockServerSpec.java From java-technology-stack with MIT License | 4 votes |
@Override public <T extends B> T webSessionManager(WebSessionManager sessionManager) { this.sessionManager = sessionManager; return self(); }
Example #6
Source File: MockServerWebExchange.java From java-technology-stack with MIT License | 4 votes |
private MockServerWebExchange(MockServerHttpRequest request, WebSessionManager sessionManager) { super(request, new MockServerHttpResponse(), sessionManager, ServerCodecConfigurer.create(), new AcceptHeaderLocaleContextResolver()); }
Example #7
Source File: MockServerWebExchange.java From java-technology-stack with MIT License | 4 votes |
private MockServerWebExchange(MockServerHttpRequest request, WebSessionManager sessionManager) { super(request, new MockServerHttpResponse(), sessionManager, ServerCodecConfigurer.create(), new AcceptHeaderLocaleContextResolver()); }
Example #8
Source File: DefaultServerWebExchange.java From java-technology-stack with MIT License | 4 votes |
public DefaultServerWebExchange(ServerHttpRequest request, ServerHttpResponse response, WebSessionManager sessionManager, ServerCodecConfigurer codecConfigurer, LocaleContextResolver localeContextResolver) { this(request, response, sessionManager, codecConfigurer, localeContextResolver, null); }
Example #9
Source File: HttpWebHandlerAdapter.java From java-technology-stack with MIT License | 4 votes |
/** * Return the configured {@link WebSessionManager}. */ public WebSessionManager getSessionManager() { return this.sessionManager; }
Example #10
Source File: ApplicationContextSpecTests.java From java-technology-stack with MIT License | 4 votes |
@Bean public WebSessionManager webSessionManager() { MockWebSession session = new MockWebSession(); return exchange -> Mono.just(session); }
Example #11
Source File: SaveSessionGatewayFilterFactoryTests.java From spring-cloud-gateway with Apache License 2.0 | 4 votes |
@Bean WebSessionManager webSessionManager() { return exchange -> Mono.just(mockWebSession); }
Example #12
Source File: ApplicationContextSpecTests.java From spring-analysis-note with MIT License | 4 votes |
@Bean public WebSessionManager webSessionManager() { MockWebSession session = new MockWebSession(); return exchange -> Mono.just(session); }
Example #13
Source File: AbstractMockServerSpec.java From spring-analysis-note with MIT License | 4 votes |
@Override public <T extends B> T webSessionManager(WebSessionManager sessionManager) { this.sessionManager = sessionManager; return self(); }
Example #14
Source File: MockServerWebExchange.java From spring-analysis-note with MIT License | 4 votes |
private MockServerWebExchange(MockServerHttpRequest request, WebSessionManager sessionManager) { super(request, new MockServerHttpResponse(), sessionManager, ServerCodecConfigurer.create(), new AcceptHeaderLocaleContextResolver()); }
Example #15
Source File: MockServerWebExchange.java From spring-analysis-note with MIT License | 4 votes |
private MockServerWebExchange(MockServerHttpRequest request, WebSessionManager sessionManager) { super(request, new MockServerHttpResponse(), sessionManager, ServerCodecConfigurer.create(), new AcceptHeaderLocaleContextResolver()); }
Example #16
Source File: DefaultServerWebExchange.java From spring-analysis-note with MIT License | 4 votes |
public DefaultServerWebExchange(ServerHttpRequest request, ServerHttpResponse response, WebSessionManager sessionManager, ServerCodecConfigurer codecConfigurer, LocaleContextResolver localeContextResolver) { this(request, response, sessionManager, codecConfigurer, localeContextResolver, null); }
Example #17
Source File: HttpWebHandlerAdapter.java From spring-analysis-note with MIT License | 4 votes |
/** * Return the configured {@link WebSessionManager}. */ public WebSessionManager getSessionManager() { return this.sessionManager; }
Example #18
Source File: HttpWebHandlerAdapter.java From java-technology-stack with MIT License | 2 votes |
/** * Configure a custom {@link WebSessionManager} to use for managing web * sessions. The provided instance is set on each created * {@link DefaultServerWebExchange}. * <p>By default this is set to {@link DefaultWebSessionManager}. * @param sessionManager the session manager to use */ public void setSessionManager(WebSessionManager sessionManager) { Assert.notNull(sessionManager, "WebSessionManager must not be null"); this.sessionManager = sessionManager; }
Example #19
Source File: WebTestClient.java From java-technology-stack with MIT License | 2 votes |
/** * Provide a session manager instance for the mock server. * <p>By default an instance of * {@link org.springframework.web.server.session.DefaultWebSessionManager * DefaultWebSessionManager} is used. * @param sessionManager the session manager to use */ <T extends B> T webSessionManager(WebSessionManager sessionManager);
Example #20
Source File: WebHttpHandlerBuilder.java From spring-analysis-note with MIT License | 2 votes |
/** * Configure the {@link WebSessionManager} to set on the * {@link ServerWebExchange WebServerExchange}. * <p>By default {@link DefaultWebSessionManager} is used. * @param manager the session manager * @see HttpWebHandlerAdapter#setSessionManager(WebSessionManager) */ public WebHttpHandlerBuilder sessionManager(WebSessionManager manager) { this.sessionManager = manager; return this; }
Example #21
Source File: WebHttpHandlerBuilder.java From java-technology-stack with MIT License | 2 votes |
/** * Configure the {@link WebSessionManager} to set on the * {@link ServerWebExchange WebServerExchange}. * <p>By default {@link DefaultWebSessionManager} is used. * @param manager the session manager * @see HttpWebHandlerAdapter#setSessionManager(WebSessionManager) */ public WebHttpHandlerBuilder sessionManager(WebSessionManager manager) { this.sessionManager = manager; return this; }
Example #22
Source File: WebTestClient.java From spring-analysis-note with MIT License | 2 votes |
/** * Provide a session manager instance for the mock server. * <p>By default an instance of * {@link org.springframework.web.server.session.DefaultWebSessionManager * DefaultWebSessionManager} is used. * @param sessionManager the session manager to use */ <T extends B> T webSessionManager(WebSessionManager sessionManager);
Example #23
Source File: HttpWebHandlerAdapter.java From spring-analysis-note with MIT License | 2 votes |
/** * Configure a custom {@link WebSessionManager} to use for managing web * sessions. The provided instance is set on each created * {@link DefaultServerWebExchange}. * <p>By default this is set to {@link DefaultWebSessionManager}. * @param sessionManager the session manager to use */ public void setSessionManager(WebSessionManager sessionManager) { Assert.notNull(sessionManager, "WebSessionManager must not be null"); this.sessionManager = sessionManager; }