public class Session extends Object implements SessionHandler.SessionIf
SessionCache. The purpose of the
SessionCache is to keep the working set of Session objects in memory so that
they may be accessed quickly, and facilitate the sharing of a Session object
amongst multiple simultaneous requests referring to the same session id.
The SessionHandler coordinates the lifecycle of Session objects with
the help of the SessionCache.SessionHandler,
SessionIdManager| Modifier and Type | Class and Description |
|---|---|
static class |
Session.IdState |
class |
Session.SessionInactivityTimer
SessionInactivityTimer
Each Session has a timer associated with it that fires whenever it has
been idle (ie not accessed by a request) for a configurable amount of
time, or the Session expires.
|
static class |
Session.State
State
Validity states of a session
|
| Modifier and Type | Field and Description |
|---|---|
static String |
SESSION_CREATED_SECURE |
| Constructor and Description |
|---|
Session(SessionHandler handler,
HttpServletRequest request,
SessionData data)
Create a new session
|
Session(SessionHandler handler,
SessionData data)
Re-inflate an existing session from some eg persistent store.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bindValue(String name,
Object value)
Bind value if value implements
HttpSessionBindingListener (calls
HttpSessionBindingListener.valueBound(HttpSessionBindingEvent)) |
long |
calculateInactivityTimeout(long now)
Calculate what the session timer setting should be based on:
the time remaining before the session expires
and any idle eviction time configured.
|
void |
didActivate()
Call the activation listeners.
|
Object |
getAttribute(String name) |
Enumeration<String> |
getAttributeNames() |
int |
getAttributes() |
String |
getContextPath() |
long |
getCookieSetTime() |
long |
getCreationTime() |
String |
getExtendedId() |
String |
getId() |
long |
getLastAccessedTime() |
int |
getMaxInactiveInterval() |
Set<String> |
getNames() |
long |
getRequests()
Returns the current number of requests that are active in the Session.
|
ServletContext |
getServletContext() |
Session |
getSession() |
HttpSessionContext |
getSessionContext()
Deprecated.
|
SessionHandler |
getSessionHandler() |
Object |
getValue(String name)
Deprecated.
|
String[] |
getValueNames()
Deprecated.
As of Version 2.2, this method is replaced by
getAttributeNames() |
String |
getVHost() |
void |
invalidate()
Called by users to invalidate a session, or called by the access method
as a request enters the session if the session has expired, or called by
manager as a result of scavenger expiring session
|
boolean |
isChanging() |
boolean |
isIdChanged() |
boolean |
isInvalid() |
boolean |
isNew() |
boolean |
isResident() |
boolean |
isValid() |
Locker.Lock |
lock()
Grab the lock on the session
|
void |
putValue(String name,
Object value)
Deprecated.
|
void |
removeAttribute(String name) |
void |
removeValue(String name)
Deprecated.
|
void |
renewId(HttpServletRequest request)
Force a change to the id of a session.
|
void |
setAttribute(String name,
Object value) |
void |
setExtendedId(String extendedId) |
void |
setIdChanged(boolean changed) |
void |
setMaxInactiveInterval(int secs) |
void |
setResident(boolean resident) |
String |
toString() |
void |
unbindValue(String name,
Object value)
Unbind value if value implements
HttpSessionBindingListener
(calls
HttpSessionBindingListener.valueUnbound(HttpSessionBindingEvent)) |
void |
updateInactivityTimer()
Deprecated.
|
void |
willPassivate()
Call the passivation listeners.
|
public static final String SESSION_CREATED_SECURE
public Session(SessionHandler handler, HttpServletRequest request, SessionData data)
handler - the SessionHandler that manages this sessionrequest - the request the session should be based ondata - the session datapublic Session(SessionHandler handler, SessionData data)
handler - the SessionHandler managing the sessiondata - the session datapublic long getRequests()
public void setExtendedId(String extendedId)
public void unbindValue(String name, Object value)
HttpSessionBindingListener
(calls
HttpSessionBindingListener.valueUnbound(HttpSessionBindingEvent))name - the name with which the object is bound or unboundvalue - the bound valuepublic void bindValue(String name, Object value)
HttpSessionBindingListener (calls
HttpSessionBindingListener.valueBound(HttpSessionBindingEvent))name - the name with which the object is bound or unboundvalue - the bound valuepublic void didActivate()
public void willPassivate()
public boolean isValid()
public boolean isInvalid()
public boolean isChanging()
public long getCookieSetTime()
public long getCreationTime()
throws IllegalStateException
getCreationTime in interface HttpSessionIllegalStateExceptionpublic String getId()
getId in interface HttpSessionHttpSession.getId()public String getExtendedId()
public String getContextPath()
public String getVHost()
public long getLastAccessedTime()
getLastAccessedTime in interface HttpSessionHttpSession.getLastAccessedTime()public ServletContext getServletContext()
getServletContext in interface HttpSessionHttpSession.getServletContext()public void setMaxInactiveInterval(int secs)
setMaxInactiveInterval in interface HttpSessionHttpSession.setMaxInactiveInterval(int)@Deprecated public void updateInactivityTimer()
public long calculateInactivityTimeout(long now)
now - the time at which to calculate remaining expirypublic int getMaxInactiveInterval()
getMaxInactiveInterval in interface HttpSessionHttpSession.getMaxInactiveInterval()@Deprecated public HttpSessionContext getSessionContext()
getSessionContext in interface HttpSessionHttpSession.getSessionContext()public SessionHandler getSessionHandler()
public Object getAttribute(String name)
getAttribute in interface HttpSessionHttpSession.getAttribute(java.lang.String)@Deprecated public Object getValue(String name)
getValue in interface HttpSessionHttpSession.getValue(java.lang.String)public Enumeration<String> getAttributeNames()
getAttributeNames in interface HttpSessionHttpSession.getAttributeNames()public int getAttributes()
@Deprecated public String[] getValueNames() throws IllegalStateException
getAttributeNames()getValueNames in interface HttpSessionIllegalStateExceptionpublic void setAttribute(String name, Object value)
setAttribute in interface HttpSessionHttpSession.setAttribute(java.lang.String,
java.lang.Object)@Deprecated public void putValue(String name, Object value)
putValue in interface HttpSessionHttpSession.putValue(java.lang.String,
java.lang.Object)public void removeAttribute(String name)
removeAttribute in interface HttpSessionHttpSession.removeAttribute(java.lang.String)@Deprecated public void removeValue(String name)
removeValue in interface HttpSessionHttpSession.removeValue(java.lang.String)public void renewId(HttpServletRequest request)
request - the Request associated with the call to change id.public void invalidate()
invalidate in interface HttpSessionHttpSession.invalidate()public Locker.Lock lock()
public boolean isNew()
throws IllegalStateException
isNew in interface HttpSessionIllegalStateExceptionpublic void setIdChanged(boolean changed)
public boolean isIdChanged()
public Session getSession()
getSession in interface SessionHandler.SessionIfpublic void setResident(boolean resident)
public boolean isResident()
Copyright © 2010 - 2020 Adobe. All Rights Reserved