|
|||||||||
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 javax.servlet.http.HttpSession
interface.
Supports the Servlet 2.4 API level.
Used for testing the web framework; also useful for testing application controllers.
Field Summary | |
---|---|
private java.util.Map<java.lang.String,java.lang.Object> |
attributes
|
private long |
creationTime
|
private java.lang.String |
id
|
private boolean |
invalid
|
private boolean |
isNew
|
private long |
lastAccessedTime
|
private int |
maxInactiveInterval
|
private static int |
nextId
|
private ServletContext |
servletContext
|
static java.lang.String |
SESSION_COOKIE_NAME
|
Constructor Summary | |
---|---|
MockHttpSession()
Create a new MockHttpSession with a default MockServletContext . |
|
MockHttpSession(ServletContext servletContext)
Create a new MockHttpSession. |
|
MockHttpSession(ServletContext servletContext,
java.lang.String id)
Create a new MockHttpSession. |
Method Summary | |
---|---|
void |
access()
|
void |
clearAttributes()
Clear all of this session's attributes. |
void |
deserializeState(java.io.Serializable state)
Deserialize the attributes of this session from a state object created by serializeState() . |
java.lang.Object |
getAttribute(java.lang.String name)
|
java.util.Enumeration<java.lang.String> |
getAttributeNames()
|
long |
getCreationTime()
|
java.lang.String |
getId()
|
long |
getLastAccessedTime()
|
int |
getMaxInactiveInterval()
|
ServletContext |
getServletContext()
|
HttpSessionContext |
getSessionContext()
|
java.lang.Object |
getValue(java.lang.String name)
|
java.lang.String[] |
getValueNames()
|
void |
invalidate()
|
boolean |
isInvalid()
|
boolean |
isNew()
|
void |
putValue(java.lang.String name,
java.lang.Object value)
|
void |
removeAttribute(java.lang.String name)
|
void |
removeValue(java.lang.String name)
|
java.io.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(java.lang.String name,
java.lang.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 |
Field Detail |
---|
public static final java.lang.String SESSION_COOKIE_NAME
private static int nextId
private final java.lang.String id
private final long creationTime
private int maxInactiveInterval
private long lastAccessedTime
private final ServletContext servletContext
private final java.util.Map<java.lang.String,java.lang.Object> attributes
private boolean invalid
private boolean isNew
Constructor Detail |
---|
public MockHttpSession()
MockServletContext
.
MockServletContext
public MockHttpSession(ServletContext servletContext)
servletContext
- the ServletContext that the session runs inpublic MockHttpSession(ServletContext servletContext, java.lang.String id)
servletContext
- the ServletContext that the session runs inid
- a unique identifier for this sessionMethod Detail |
---|
public long getCreationTime()
public java.lang.String getId()
public void access()
public long getLastAccessedTime()
public ServletContext getServletContext()
public void setMaxInactiveInterval(int interval)
public int getMaxInactiveInterval()
public HttpSessionContext getSessionContext()
public java.lang.Object getAttribute(java.lang.String name)
public java.lang.Object getValue(java.lang.String name)
public java.util.Enumeration<java.lang.String> getAttributeNames()
public java.lang.String[] getValueNames()
public void setAttribute(java.lang.String name, java.lang.Object value)
public void putValue(java.lang.String name, java.lang.Object value)
public void removeAttribute(java.lang.String name)
public void removeValue(java.lang.String name)
public void clearAttributes()
public void invalidate()
public boolean isInvalid()
public void setNew(boolean value)
public boolean isNew()
public java.io.Serializable serializeState()
public void deserializeState(java.io.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 |