Class MockHttpSession

java.lang.Object
org.springframework.mock.web.MockHttpSession
All Implemented Interfaces:
HttpSession

public class MockHttpSession extends Object implements HttpSession
Mock implementation of the HttpSession interface.

As of Spring 6.0, this set of mocks is designed on a Servlet 6.0 baseline.

Since:
1.0.2
Author:
Juergen Hoeller, Rod Johnson, Mark Fisher, Sam Brannen, Vedran Pavic
  • Field Details

  • Constructor Details

    • MockHttpSession

      public MockHttpSession()
      Create a new MockHttpSession with a default MockServletContext.
      See Also:
    • MockHttpSession

      public MockHttpSession(@Nullable ServletContext servletContext)
      Create a new MockHttpSession.
      Parameters:
      servletContext - the ServletContext that the session runs in
    • MockHttpSession

      public MockHttpSession(@Nullable ServletContext servletContext, @Nullable String id)
      Create a new MockHttpSession.
      Parameters:
      servletContext - the ServletContext that the session runs in
      id - a unique identifier for this session
  • Method Details