public class MockHttpSession
extends java.lang.Object
implements javax.servlet.http.HttpSession
| Constructor and Description |
|---|
MockHttpSession(javax.servlet.ServletContext context)
Default constructor which provides the session with access to the context.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getAttribute(java.lang.String key)
Returns the value of the named attribute from an internal Map.
|
java.util.Enumeration<java.lang.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.
|
java.lang.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.
|
javax.servlet.ServletContext |
getServletContext()
Provides access to the servlet context within which the session exists.
|
javax.servlet.http.HttpSessionContext |
getSessionContext()
Deprecated method always returns null.
|
java.lang.Object |
getValue(java.lang.String key)
Deprecated method.
|
java.lang.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(java.lang.String key,
java.lang.Object value)
Stores the value in session, replacing any existing value with the same key.
|
void |
removeAttribute(java.lang.String key)
Removes any value stored in session with the key supplied.
|
void |
removeValue(java.lang.String key)
Removes any value stored in session with the key supplied.
|
void |
setAttribute(java.lang.String key,
java.lang.Object value)
Stores the value in session, replacing any existing value with the same key.
|
void |
setMaxInactiveInterval(int i)
Has no effect.
|
void |
setServletContext(javax.servlet.ServletContext context)
Sets the servlet context within which the session exists.
|
public MockHttpSession(javax.servlet.ServletContext context)
public long getCreationTime()
getCreationTime in interface javax.servlet.http.HttpSessionpublic java.lang.String getId()
getId in interface javax.servlet.http.HttpSessionpublic long getLastAccessedTime()
getLastAccessedTime in interface javax.servlet.http.HttpSessionpublic javax.servlet.ServletContext getServletContext()
getServletContext in interface javax.servlet.http.HttpSessionpublic void setServletContext(javax.servlet.ServletContext context)
public void setMaxInactiveInterval(int i)
setMaxInactiveInterval in interface javax.servlet.http.HttpSessionpublic int getMaxInactiveInterval()
getMaxInactiveInterval in interface javax.servlet.http.HttpSessionpublic javax.servlet.http.HttpSessionContext getSessionContext()
getSessionContext in interface javax.servlet.http.HttpSessionpublic java.lang.Object getAttribute(java.lang.String key)
getAttribute in interface javax.servlet.http.HttpSessionpublic java.lang.Object getValue(java.lang.String key)
getValue in interface javax.servlet.http.HttpSessionpublic java.util.Enumeration<java.lang.String> getAttributeNames()
getAttributeNames in interface javax.servlet.http.HttpSessionpublic java.lang.String[] getValueNames()
getValueNames in interface javax.servlet.http.HttpSessionpublic void setAttribute(java.lang.String key,
java.lang.Object value)
setAttribute in interface javax.servlet.http.HttpSessionpublic void putValue(java.lang.String key,
java.lang.Object value)
putValue in interface javax.servlet.http.HttpSessionpublic void removeAttribute(java.lang.String key)
removeAttribute in interface javax.servlet.http.HttpSessionpublic void removeValue(java.lang.String key)
removeValue in interface javax.servlet.http.HttpSessionpublic void invalidate()
invalidate in interface javax.servlet.http.HttpSessionpublic boolean isNew()
isNew in interface javax.servlet.http.HttpSession? Copyright 2005-2006, Stripes Development Team.