public class WrappedHttpSession extends Object implements WrappedSession
HttpSession.WrappedSession,
Serialized Form| Constructor and Description |
|---|
WrappedHttpSession(HttpSession session)
Creates a new wrapped http session.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getAttribute(String name)
Gets an attribute from this session.
|
Set<String> |
getAttributeNames()
Gets the current set of attribute names stored in this session.
|
long |
getCreationTime()
Returns the time when this session was created, measured in milliseconds
since midnight January 1, 1970 GMT.
|
HttpSession |
getHttpSession()
Gets the wrapped
HttpSession. |
String |
getId()
Gets a string with a unique identifier for the session.
|
long |
getLastAccessedTime()
Returns the last time the client sent a request associated with this
session, as the number of milliseconds since midnight January 1, 1970
GMT, and marked by the time the container received the request.
|
int |
getMaxInactiveInterval()
Returns the maximum time interval, in seconds, that this session will be
kept open between client accesses.
|
void |
invalidate()
Invalidates this session then unbinds any objects bound to it.
|
boolean |
isNew()
Returns true if the client does not yet know about the session or if the
client chooses not to join the session.
|
void |
removeAttribute(String name)
Removes the object bound with the specified name from this session.
|
void |
setAttribute(String name,
Object value)
Saves an attribute value in this session.
|
void |
setMaxInactiveInterval(int interval)
Specifies the time, in seconds, between client requests before the
servlet container will invalidate this session.
|
public WrappedHttpSession(HttpSession session)
session - the http session to wrap.public int getMaxInactiveInterval()
WrappedSessiongetMaxInactiveInterval in interface WrappedSessionjavax.servlet.http.HttpSession#getMaxInactiveInterval()public Object getAttribute(String name)
WrappedSessiongetAttribute in interface WrappedSessionname - the name of the attributenull if the attribute is not
defined in the sessionjavax.servlet.http.HttpSession#getAttribute(String)public void setAttribute(String name, Object value)
WrappedSessionsetAttribute in interface WrappedSessionname - the name of the attributevalue - the attribute valuejavax.servlet.http.HttpSession#setAttribute(String, Object)public HttpSession getHttpSession()
HttpSession.public Set<String> getAttributeNames()
WrappedSessiongetAttributeNames in interface WrappedSessionHttpSession#getAttributeNames()public void invalidate()
WrappedSessioninvalidate in interface WrappedSessionHttpSession#invalidate()public String getId()
WrappedSessiongetId in interface WrappedSessionHttpSession#getId()public long getCreationTime()
WrappedSessiongetCreationTime in interface WrappedSessionHttpSession#getCreationTime()public long getLastAccessedTime()
WrappedSessionActions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.
getLastAccessedTime in interface WrappedSessionHttpSession#getLastAccessedTime()public boolean isNew()
WrappedSessionisNew in interface WrappedSessionHttpSession#isNew()public void removeAttribute(String name)
WrappedSessionremoveAttribute in interface WrappedSessionname - the name of the object to remove from this sessionHttpSession#removeAttribute(String)public void setMaxInactiveInterval(int interval)
WrappedSessionsetMaxInactiveInterval in interface WrappedSessioninterval - An integer specifying the number of secondsHttpSession#setMaxInactiveInterval(int)Copyright © 2025. All rights reserved.