public class MockHttpSession extends Object implements HttpSession
| Constructor and Description |
|---|
MockHttpSession(ServletContext context)
Default constructor which provides the session with access to the context.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getAttribute(String key)
Returns the value of the named attribute from an internal Map.
|
Enumeration<String> |
getAttributeNames()
Returns an enumeration of all the attribute names in the session.
|
long |
getCreationTime()
Returns the time in milliseconds when the session was created.
|
String |
getId()
Returns an ID that was randomly generated when the session was created.
|
long |
getLastAccessedTime()
Always returns the current time.
|
int |
getMaxInactiveInterval()
Always returns Integer.MAX_VALUE.
|
ServletContext |
getServletContext()
Provides access to the servlet context within which the session exists.
|
HttpSessionContext |
getSessionContext()
Deprecated method always returns null.
|
Object |
getValue(String key)
Deprecated method.
|
String[] |
getValueNames()
Returns a String[] of all the attribute names in session.
|
void |
invalidate()
Clears the set of attributes, but has no other effect.
|
boolean |
isNew()
Always returns false.
|
void |
putValue(String key,
Object value)
Stores the value in session, replacing any existing value with the same key.
|
void |
removeAttribute(String key)
Removes any value stored in session with the key supplied.
|
void |
removeValue(String key)
Removes any value stored in session with the key supplied.
|
void |
setAttribute(String key,
Object value)
Stores the value in session, replacing any existing value with the same key.
|
void |
setMaxInactiveInterval(int i)
Has no effect.
|
void |
setServletContext(ServletContext context)
Sets the servlet context within which the session exists.
|
public MockHttpSession(ServletContext context)
public long getCreationTime()
getCreationTime in interface HttpSessionpublic String getId()
getId in interface HttpSessionpublic long getLastAccessedTime()
getLastAccessedTime in interface HttpSessionpublic ServletContext getServletContext()
getServletContext in interface HttpSessionpublic void setServletContext(ServletContext context)
public void setMaxInactiveInterval(int i)
setMaxInactiveInterval in interface HttpSessionpublic int getMaxInactiveInterval()
getMaxInactiveInterval in interface HttpSessionpublic HttpSessionContext getSessionContext()
getSessionContext in interface HttpSessionpublic Object getAttribute(String key)
getAttribute in interface HttpSessionpublic Object getValue(String key)
getValue in interface HttpSessionpublic Enumeration<String> getAttributeNames()
getAttributeNames in interface HttpSessionpublic String[] getValueNames()
getValueNames in interface HttpSessionpublic void setAttribute(String key, Object value)
setAttribute in interface HttpSessionpublic void putValue(String key, Object value)
putValue in interface HttpSessionpublic void removeAttribute(String key)
removeAttribute in interface HttpSessionpublic void removeValue(String key)
removeValue in interface HttpSessionpublic void invalidate()
invalidate in interface HttpSessionpublic boolean isNew()
isNew in interface HttpSession© Copyright 2005-2006, Stripes Development Team.