public class MockHttpSession extends Object implements javax.servlet.http.HttpSession, Serializable
WebSession interface for use by the test harnesses.| Constructor and Description |
|---|
MockHttpSession(javax.servlet.ServletContext context)
Create the session.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getAttribute(String name)
Get the attribute with the given name.
|
Enumeration<String> |
getAttributeNames()
Get the names of the attributes in the session.
|
long |
getCreationTime()
Get the creation time of the session.
|
String |
getId()
Return the id of this session.
|
long |
getLastAccessedTime()
Get the time the session was last accessed.
|
int |
getMaxInactiveInterval()
NOT USED.
|
javax.servlet.ServletContext |
getServletContext()
Return the servlet context for the session.
|
javax.servlet.http.HttpSessionContext |
getSessionContext()
Deprecated.
|
Object |
getValue(String name)
Deprecated.
use getAttribute(String) instead
|
String[] |
getValueNames()
Deprecated.
use getAttributeNames() instead
|
void |
invalidate()
Invalidate the session.
|
boolean |
isNew()
Check if the session is new.
|
boolean |
isTemporary()
Indicates the state of the session.
|
void |
putValue(String name,
Object o)
Deprecated.
Use setAttribute(String, Object) instead
|
void |
removeAttribute(String name)
Remove an attribute.
|
void |
removeValue(String name)
Deprecated.
Use removeAttribute(String) instead
|
void |
setAttribute(String name,
Object o)
Set an attribute.
|
void |
setMaxInactiveInterval(int i)
NOT USED.
|
void |
setTemporary(boolean temporary)
Changes the state of this session.
|
void |
timestamp()
Set the last accessed time for the session.
|
public MockHttpSession(javax.servlet.ServletContext context)
context - public Object getAttribute(String name)
getAttribute in interface javax.servlet.http.HttpSessionname - The attribute namepublic Enumeration<String> getAttributeNames()
getAttributeNames in interface javax.servlet.http.HttpSessionpublic long getCreationTime()
getCreationTime in interface javax.servlet.http.HttpSessionpublic String getId()
getId in interface javax.servlet.http.HttpSessionpublic long getLastAccessedTime()
getLastAccessedTime in interface javax.servlet.http.HttpSessionpublic int getMaxInactiveInterval()
getMaxInactiveInterval in interface javax.servlet.http.HttpSessionpublic javax.servlet.ServletContext getServletContext()
getServletContext in interface javax.servlet.http.HttpSession@Deprecated public javax.servlet.http.HttpSessionContext getSessionContext()
getSessionContext in interface javax.servlet.http.HttpSession@Deprecated public Object getValue(String name)
getValue in interface javax.servlet.http.HttpSessionname - The name@Deprecated public String[] getValueNames()
getValueNames in interface javax.servlet.http.HttpSessionpublic void invalidate()
invalidate in interface javax.servlet.http.HttpSessionpublic boolean isNew()
isNew in interface javax.servlet.http.HttpSession@Deprecated public void putValue(String name, Object o)
putValue in interface javax.servlet.http.HttpSessionname - The name of the valueo - The valuepublic void removeAttribute(String name)
removeAttribute in interface javax.servlet.http.HttpSessionname - The name of the attribute@Deprecated public void removeValue(String name)
removeValue in interface javax.servlet.http.HttpSessionname - The name of the valuepublic void setAttribute(String name, Object o)
setAttribute in interface javax.servlet.http.HttpSessionname - The name of the attribute to seto - The value to setpublic void setMaxInactiveInterval(int i)
setMaxInactiveInterval in interface javax.servlet.http.HttpSessioni - The valuepublic void timestamp()
public final boolean isTemporary()
public final void setTemporary(boolean temporary)
temporary - true, for a temporary session, false for a persisted sessionCopyright © 2006–2014 Apache Software Foundation. All rights reserved.