|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.messagelet.impl.HttpSessionImpl
public class HttpSessionImpl
Based on the Catalina StandardSession class. Standard implementation of the HttpSession interface. This object is serializable, so that it can be stored in persistent storage or transferred to a different JVM for distributable session support.
Field Summary | |
---|---|
protected javax.servlet.ServletContext |
servletContext
The ServletContext |
Constructor Summary | |
---|---|
HttpSessionImpl(javax.servlet.ServletContext servletContext)
|
Method Summary | |
---|---|
void |
access()
Update the accessed time information for this session. |
void |
activate()
Perform internal processing required to activate this session. |
void |
expire()
Perform the internal processing required to invalidate this session, without triggering an exception if the session has already expired. |
void |
fireSessionEvent(String type,
Object data)
Notify all session event listeners that a particular event has occurred for this Session. |
Object |
getAttribute(String name)
Return the object bound with the specified name in this session, or null if no object is bound with that name. |
Enumeration |
getAttributeNames()
Return an Enumeration of String objects
containing the names of the objects bound to this session. |
String |
getAuthType()
Return the authentication type used to authenticate our cached Principal, if any. |
long |
getCreationTime()
Return the time when this session was created, in milliseconds since midnight, January 1, 1970 GMT. |
String |
getId()
Return the session identifier for this session. |
long |
getLastAccessedTime()
Return the last time the client sent a request associated with this session, as the number of milliseconds since midnight, January 1, 1970 GMT. |
int |
getMaxInactiveInterval()
Return the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session. |
Object |
getNote(String name)
Return the object bound with the specified name to the internal notes for this session, or null if no such binding exists. |
Iterator |
getNoteNames()
Return an Iterator containing the String names of all notes bindings that exist for this session. |
Principal |
getPrincipal()
Return the authenticated Principal that is associated with this Session. |
javax.servlet.ServletContext |
getServletContext()
Return the ServletContext to which this session belongs. |
javax.servlet.http.HttpSessionContext |
getSessionContext()
Deprecated. As of Version 2.1, this method is deprecated and has no replacement. It will be removed in a future version of the Java Servlet API. |
Object |
getValue(String name)
Deprecated. As of Version 2.2, this method is replaced by getAttribute() |
String[] |
getValueNames()
Deprecated. As of Version 2.2, this method is replaced by getAttributeNames() |
void |
invalidate()
Invalidates this session and unbinds any objects bound to it. |
boolean |
isNew()
Return true if the client does not yet know about the
session, or if the client chooses not to join the session. |
boolean |
isValid()
Return the isValid flag for this session. |
protected void |
log(String message)
Log a message to the current ServletContext |
protected void |
log(String message,
Throwable throwable)
Log a message to the current ServletContext |
void |
passivate()
Perform the internal processing required to passivate this session. |
void |
putValue(String name,
Object value)
Deprecated. As of Version 2.2, this method is replaced by setAttribute() |
void |
recycle()
Release all object references, and initialize instance variables, in preparation for reuse of this object. |
void |
removeAttribute(String name)
Remove the object bound with the specified name from this session. |
void |
removeNote(String name)
Remove any object bound to the specified name in the internal notes for this session. |
void |
removeValue(String name)
Deprecated. As of Version 2.2, this method is replaced by removeAttribute() |
void |
setAttribute(String name,
Object value)
Bind an object to this session, using the specified name. |
void |
setAuthType(String authType)
Set the authentication type used to authenticate our cached Principal, if any. |
void |
setCreationTime(long time)
Set the creation time for this session. |
void |
setId(String id)
Set the session identifier for this session. |
void |
setMaxInactiveInterval(int interval)
Set the maximum time interval, in seconds, between client requests before the servlet container will invalidate the session. |
void |
setNew(boolean isNew)
Set the isNew flag for this session. |
void |
setNote(String name,
Object value)
Bind an object to a specified name in the internal notes associated with this session, replacing any existing binding for this name. |
void |
setPrincipal(Principal principal)
Set the authenticated Principal that is associated with this Session. |
void |
setValid(boolean isValid)
Set the isValid flag for this session. |
String |
toString()
Return a string representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected javax.servlet.ServletContext servletContext
Constructor Detail |
---|
public HttpSessionImpl(javax.servlet.ServletContext servletContext)
Method Detail |
---|
public String getAuthType()
public void setAuthType(String authType)
authType
- The new cached authentication typepublic void setCreationTime(long time)
time
- The new creation timepublic String getId()
getId
in interface javax.servlet.http.HttpSession
public void setId(String id)
id
- The new session identifierpublic long getLastAccessedTime()
getLastAccessedTime
in interface javax.servlet.http.HttpSession
public int getMaxInactiveInterval()
getMaxInactiveInterval
in interface javax.servlet.http.HttpSession
IllegalStateException
- if this method is called on
an invalidated sessionpublic void setMaxInactiveInterval(int interval)
setMaxInactiveInterval
in interface javax.servlet.http.HttpSession
interval
- The new maximum intervalpublic void setNew(boolean isNew)
isNew
flag for this session.
isNew
- The new value for the isNew
flagpublic Principal getPrincipal()
Authenticator
with a means to cache a
previously authenticated Principal, and avoid potentially expensive
Realm.authenticate()
calls on every request. If there
is no current associated Principal, return null
.
public void setPrincipal(Principal principal)
Authenticator
with a means to cache a
previously authenticated Principal, and avoid potentially expensive
Realm.authenticate()
calls on every request.
principal
- The new Principal, or null
if nonepublic boolean isValid()
isValid
flag for this session.
public void setValid(boolean isValid)
isValid
flag for this session.
isValid
- The new value for the isValid
flagpublic void access()
public void expire()
public void passivate()
public void activate()
public Object getNote(String name)
null
if no such binding exists.
name
- Name of the note to be returnedpublic Iterator getNoteNames()
public void recycle()
public void removeNote(String name)
name
- Name of the note to be removedpublic void setNote(String name, Object value)
name
- Name to which the object should be boundvalue
- Object to be bound to the specified namepublic String toString()
toString
in class Object
public long getCreationTime()
getCreationTime
in interface javax.servlet.http.HttpSession
IllegalStateException
- if this method is called on an
invalidated sessionpublic javax.servlet.ServletContext getServletContext()
getServletContext
in interface javax.servlet.http.HttpSession
public javax.servlet.http.HttpSessionContext getSessionContext()
getSessionContext
in interface javax.servlet.http.HttpSession
public Object getAttribute(String name)
null
if no object is bound with that name.
getAttribute
in interface javax.servlet.http.HttpSession
name
- Name of the attribute to be returned
IllegalStateException
- if this method is called on an
invalidated sessionpublic Enumeration getAttributeNames()
Enumeration
of String
objects
containing the names of the objects bound to this session.
getAttributeNames
in interface javax.servlet.http.HttpSession
IllegalStateException
- if this method is called on an
invalidated sessionpublic Object getValue(String name)
getAttribute()
null
if no object is bound with that name.
getValue
in interface javax.servlet.http.HttpSession
name
- Name of the value to be returned
IllegalStateException
- if this method is called on an
invalidated sessionpublic String[] getValueNames()
getAttributeNames()
getValueNames
in interface javax.servlet.http.HttpSession
IllegalStateException
- if this method is called on an
invalidated sessionpublic void invalidate()
invalidate
in interface javax.servlet.http.HttpSession
IllegalStateException
- if this method is called on
an invalidated sessionpublic boolean isNew()
true
if the client does not yet know about the
session, or if the client chooses not to join the session. For
example, if the server used only cookie-based sessions, and the client
has disabled the use of cookies, then a session would be new on each
request.
isNew
in interface javax.servlet.http.HttpSession
IllegalStateException
- if this method is called on an
invalidated sessionpublic void putValue(String name, Object value)
setAttribute()
After this method executes, and if the object implements
HttpSessionBindingListener
, the container calls
valueBound()
on the object.
putValue
in interface javax.servlet.http.HttpSession
name
- Name to which the object is bound, cannot be nullvalue
- Object to be bound, cannot be null
IllegalStateException
- if this method is called on an
invalidated sessionpublic void removeAttribute(String name)
After this method executes, and if the object implements
HttpSessionBindingListener
, the container calls
valueUnbound()
on the object.
removeAttribute
in interface javax.servlet.http.HttpSession
name
- Name of the object to remove from this session.
IllegalStateException
- if this method is called on an
invalidated sessionpublic void removeValue(String name)
removeAttribute()
After this method executes, and if the object implements
HttpSessionBindingListener
, the container calls
valueUnbound()
on the object.
removeValue
in interface javax.servlet.http.HttpSession
name
- Name of the object to remove from this session.
IllegalStateException
- if this method is called on an
invalidated sessionpublic void setAttribute(String name, Object value)
After this method executes, and if the object implements
HttpSessionBindingListener
, the container calls
valueBound()
on the object.
setAttribute
in interface javax.servlet.http.HttpSession
name
- Name to which the object is bound, cannot be nullvalue
- Object to be bound, cannot be null
IllegalArgumentException
- if an attempt is made to add a
non-serializable object in an environment marked distributable.
IllegalStateException
- if this method is called on an
invalidated sessionpublic void fireSessionEvent(String type, Object data)
type
- Event typedata
- Event dataprotected void log(String message)
message
- Message to be loggedprotected void log(String message, Throwable throwable)
message
- Message to be loggedthrowable
- Associated exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |