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.HttpSession
public java.lang.String getId()
getId
in interface javax.servlet.http.HttpSession
public long getLastAccessedTime()
getLastAccessedTime
in interface javax.servlet.http.HttpSession
public javax.servlet.ServletContext getServletContext()
getServletContext
in interface javax.servlet.http.HttpSession
public void setServletContext(javax.servlet.ServletContext context)
public void setMaxInactiveInterval(int i)
setMaxInactiveInterval
in interface javax.servlet.http.HttpSession
public int getMaxInactiveInterval()
getMaxInactiveInterval
in interface javax.servlet.http.HttpSession
public javax.servlet.http.HttpSessionContext getSessionContext()
getSessionContext
in interface javax.servlet.http.HttpSession
public java.lang.Object getAttribute(java.lang.String key)
getAttribute
in interface javax.servlet.http.HttpSession
public java.lang.Object getValue(java.lang.String key)
getValue
in interface javax.servlet.http.HttpSession
public java.util.Enumeration<java.lang.String> getAttributeNames()
getAttributeNames
in interface javax.servlet.http.HttpSession
public java.lang.String[] getValueNames()
getValueNames
in interface javax.servlet.http.HttpSession
public void setAttribute(java.lang.String key, java.lang.Object value)
setAttribute
in interface javax.servlet.http.HttpSession
public void putValue(java.lang.String key, java.lang.Object value)
putValue
in interface javax.servlet.http.HttpSession
public void removeAttribute(java.lang.String key)
removeAttribute
in interface javax.servlet.http.HttpSession
public void removeValue(java.lang.String key)
removeValue
in interface javax.servlet.http.HttpSession
public void invalidate()
invalidate
in interface javax.servlet.http.HttpSession
public boolean isNew()
isNew
in interface javax.servlet.http.HttpSession
? Copyright 2005-2006, Stripes Development Team.