spring-framework / org.springframework.test.web.servlet.setup / SharedHttpSessionConfigurer

SharedHttpSessionConfigurer

open class SharedHttpSessionConfigurer : MockMvcConfigurer

MockMvcConfigurer that stores and re-uses the HTTP session across multiple requests performed through the same MockMvc instance.

Example use:

 import static org.springframework.test.web.servlet.setup.SharedHttpSessionConfigurer.sharedHttpSession; // ... MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new TestController()) .apply(sharedHttpSession()) .build(); // Use mockMvc to perform requests ... 

Author
Rossen Stoyanchev

Since
5.0

Constructors

<init>

SharedHttpSessionConfigurer()

MockMvcConfigurer that stores and re-uses the HTTP session across multiple requests performed through the same MockMvc instance.

Example use:

 import static org.springframework.test.web.servlet.setup.SharedHttpSessionConfigurer.sharedHttpSession; // ... MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new TestController()) .apply(sharedHttpSession()) .build(); // Use mockMvc to perform requests ... 

Functions

afterConfigurerAdded

open fun afterConfigurerAdded(builder: ConfigurableMockMvcBuilder<*>): Unit

beforeMockMvcCreated

open fun beforeMockMvcCreated(builder: ConfigurableMockMvcBuilder<*>, context: WebApplicationContext): RequestPostProcessor

sharedHttpSession

open static fun sharedHttpSession(): SharedHttpSessionConfigurer