Package org.apache.juneau.rest.mock
Class MockHttpSession
java.lang.Object
org.apache.juneau.rest.mock.MockHttpSession
- All Implemented Interfaces:
- jakarta.servlet.http.HttpSession
An implementation of 
HttpSession for mocking purposes.
 
 Session-based tests can use this API to create customized instances of HttpSession objects
 that can be passed to the MockRestRequest.httpSession(HttpSession) method.
 
See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from interface jakarta.servlet.http.HttpSessionjakarta.servlet.http.HttpSession.Accessor
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic MockHttpSessioncreate()Creates a new HTTP session.creationTime(long value) Sets the creation time on this session.getAttribute(String name) longgetId()longintjakarta.servlet.ServletContextSets the id on this session.voidbooleanisNew()isNew(boolean value) Sets the is-new value on this session.lastAccessedTime(long value) Sets the last-accessed time on this session.maxInactiveInterval(int value) Sets the max-inactive interval time on this session.voidremoveAttribute(String name) servletContext(jakarta.servlet.ServletContext value) Sets the servlet context on this session.voidsetAttribute(String name, Object value) voidsetMaxInactiveInterval(int value) Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.servlet.http.HttpSessiongetAccessor
- 
Constructor Details- 
MockHttpSessionpublic MockHttpSession()
 
- 
- 
Method Details- 
createCreates a new HTTP session.- Returns:
- A new HTTP session.
 
- 
creationTimeSets the creation time on this session.Affects the results of calling HttpSession.getCreationTime().- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
lastAccessedTimeSets the last-accessed time on this session.Affects the results of calling HttpSession.getLastAccessedTime().- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
maxInactiveIntervalSets the max-inactive interval time on this session.Affects the results of calling HttpSession.getMaxInactiveInterval().- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
idSets the id on this session.Affects the results of calling HttpSession.getId().- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
servletContextSets the servlet context on this session.Affects the results of calling HttpSession.getServletContext().- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
isNewSets the is-new value on this session.Affects the results of calling HttpSession.isNew().- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
getCreationTime- Specified by:
- getCreationTimein interface- jakarta.servlet.http.HttpSession
 
- 
getId- Specified by:
- getIdin interface- jakarta.servlet.http.HttpSession
 
- 
getLastAccessedTime- Specified by:
- getLastAccessedTimein interface- jakarta.servlet.http.HttpSession
 
- 
getServletContext- Specified by:
- getServletContextin interface- jakarta.servlet.http.HttpSession
 
- 
setMaxInactiveInterval- Specified by:
- setMaxInactiveIntervalin interface- jakarta.servlet.http.HttpSession
 
- 
getMaxInactiveInterval- Specified by:
- getMaxInactiveIntervalin interface- jakarta.servlet.http.HttpSession
 
- 
getAttribute- Specified by:
- getAttributein interface- jakarta.servlet.http.HttpSession
 
- 
getAttributeNames- Specified by:
- getAttributeNamesin interface- jakarta.servlet.http.HttpSession
 
- 
setAttribute- Specified by:
- setAttributein interface- jakarta.servlet.http.HttpSession
 
- 
removeAttribute- Specified by:
- removeAttributein interface- jakarta.servlet.http.HttpSession
 
- 
invalidate- Specified by:
- invalidatein interface- jakarta.servlet.http.HttpSession
 
- 
isNew- Specified by:
- isNewin interface- jakarta.servlet.http.HttpSession
 
 
-