|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.mock.web.MockHttpSession
public class MockHttpSession
Mock implementation of the HttpSession
interface.
Compatible with Servlet 2.5 as well as Servlet 3.0.
Constructor Summary | |
---|---|
MockHttpSession()
Create a new MockHttpSession with a default MockServletContext . |
|
MockHttpSession(ServletContext servletContext)
Create a new MockHttpSession. |
|
MockHttpSession(ServletContext servletContext,
String id)
Create a new MockHttpSession. |
Method Summary | |
---|---|
void |
access()
|
void |
clearAttributes()
Clear all of this session's attributes. |
void |
deserializeState(Serializable state)
Deserialize the attributes of this session from a state object created by serializeState() . |
Object |
getAttribute(String name)
|
Enumeration<String> |
getAttributeNames()
|
long |
getCreationTime()
|
String |
getId()
|
long |
getLastAccessedTime()
|
int |
getMaxInactiveInterval()
|
ServletContext |
getServletContext()
|
HttpSessionContext |
getSessionContext()
|
Object |
getValue(String name)
|
String[] |
getValueNames()
|
void |
invalidate()
|
boolean |
isInvalid()
|
boolean |
isNew()
|
void |
putValue(String name,
Object value)
|
void |
removeAttribute(String name)
|
void |
removeValue(String name)
|
Serializable |
serializeState()
Serialize the attributes of this session into an object that can be turned into a byte array with standard Java serialization. |
void |
setAttribute(String name,
Object value)
|
void |
setMaxInactiveInterval(int interval)
|
void |
setNew(boolean value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MockHttpSession()
MockServletContext
.
MockServletContext
public MockHttpSession(ServletContext servletContext)
servletContext
- the ServletContext that the session runs inpublic MockHttpSession(ServletContext servletContext, String id)
servletContext
- the ServletContext that the session runs inid
- a unique identifier for this sessionMethod Detail |
---|
public long getCreationTime()
getCreationTime
in interface HttpSession
public String getId()
getId
in interface HttpSession
public void access()
public long getLastAccessedTime()
getLastAccessedTime
in interface HttpSession
public ServletContext getServletContext()
getServletContext
in interface HttpSession
public void setMaxInactiveInterval(int interval)
setMaxInactiveInterval
in interface HttpSession
public int getMaxInactiveInterval()
getMaxInactiveInterval
in interface HttpSession
public HttpSessionContext getSessionContext()
getSessionContext
in interface HttpSession
public Object getAttribute(String name)
getAttribute
in interface HttpSession
public Object getValue(String name)
getValue
in interface HttpSession
public Enumeration<String> getAttributeNames()
getAttributeNames
in interface HttpSession
public String[] getValueNames()
getValueNames
in interface HttpSession
public void setAttribute(String name, Object value)
setAttribute
in interface HttpSession
public void putValue(String name, Object value)
putValue
in interface HttpSession
public void removeAttribute(String name)
removeAttribute
in interface HttpSession
public void removeValue(String name)
removeValue
in interface HttpSession
public void clearAttributes()
public void invalidate()
invalidate
in interface HttpSession
public boolean isInvalid()
public void setNew(boolean value)
public boolean isNew()
isNew
in interface HttpSession
public Serializable serializeState()
public void deserializeState(Serializable state)
serializeState()
.
state
- a representation of this session's serialized state
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |