Top Description Fields Constructors Methods
org.apache.catalina.session

public Class StandardSessionFacade

extends Object
implements HttpSession
Class Inheritance
All Implemented Interfaces
jakarta.servlet.http.HttpSession
Imports
java.util.Enumeration, jakarta.servlet.ServletContext, jakarta.servlet.http.HttpSession

Facade for the StandardSession object.
Author
Remy Maucherat

Field Summary

Modifier and TypeField and Description
private final HttpSession
session

Wrapped session object.

Constructor Summary

AccessConstructor and Description
public
StandardSessionFacade(HttpSession
The session instance to wrap
session
)

Construct a new session facade.

Method Summary

Modifier and TypeMethod and Description
public Object
getAttribute(String
a string specifying the name of the object
name
)

Implements jakarta.servlet.http.HttpSession.getAttribute.

Returns the object bound with the specified name in this session, or null if no object is bound under the name.

public Enumeration<String>
getAttributeNames()

Implements jakarta.servlet.http.HttpSession.getAttributeNames.

Returns an Enumeration of String objects containing the names of all the objects bound to this session.

public long
getCreationTime()

Implements jakarta.servlet.http.HttpSession.getCreationTime.

Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.

public String
getId()

Implements jakarta.servlet.http.HttpSession.getId.

Returns a string containing the unique identifier assigned to this session.

public long
getLastAccessedTime()

Implements jakarta.servlet.http.HttpSession.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.

public int
getMaxInactiveInterval()

Implements jakarta.servlet.http.HttpSession.getMaxInactiveInterval.

Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses.

public ServletContext
getServletContext()

Implements jakarta.servlet.http.HttpSession.getServletContext.

Returns the ServletContext to which this session belongs.

public void
invalidate()

Implements jakarta.servlet.http.HttpSession.invalidate.

Invalidates this session then unbinds any objects bound to it.

public boolean
isNew()

Implements jakarta.servlet.http.HttpSession.isNew.

Returns true if the client does not yet know about the session or if the client chooses not to join the session.

public void
removeAttribute(String
the name of the object to remove from this session
name
)

Implements jakarta.servlet.http.HttpSession.removeAttribute.

Removes the object bound with the specified name from this session.

public void
setAttribute(String
the name to which the object is bound; cannot be null
name
,
Object
the object to be bound
value
)

Implements jakarta.servlet.http.HttpSession.setAttribute.

Binds an object to this session, using the name specified.

public void
setMaxInactiveInterval(int
An integer specifying the number of seconds
interval
)

Implements jakarta.servlet.http.HttpSession.setMaxInactiveInterval.

Specifies the time, in seconds, between client requests before the servlet container will invalidate this session.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

sessionback to summary
private final HttpSession session

Wrapped session object.

Constructor Detail

StandardSessionFacadeback to summary
public StandardSessionFacade(HttpSession session)

Construct a new session facade.

Parameters
session:HttpSession

The session instance to wrap

Method Detail

getAttributeback to summary
public Object getAttribute(String name)

Implements jakarta.servlet.http.HttpSession.getAttribute.

Doc from jakarta.servlet.http.HttpSession.getAttribute.

Returns the object bound with the specified name in this session, or null if no object is bound under the name.

Parameters
name:String

a string specifying the name of the object

Returns:Object

the object with the specified name

Annotations
@Override
getAttributeNamesback to summary
public Enumeration<String> getAttributeNames()

Implements jakarta.servlet.http.HttpSession.getAttributeNames.

Doc from jakarta.servlet.http.HttpSession.getAttributeNames.

Returns an Enumeration of String objects containing the names of all the objects bound to this session.

Returns:Enumeration<String>

an Enumeration of String objects specifying the names of all the objects bound to this session

Annotations
@Override
getCreationTimeback to summary
public long getCreationTime()

Implements jakarta.servlet.http.HttpSession.getCreationTime.

Doc from jakarta.servlet.http.HttpSession.getCreationTime.

Returns the time when this session was created, measured in milliseconds since midnight January 1, 1970 GMT.

Returns:long

a long specifying when this session was created, expressed in milliseconds since 1/1/1970 GMT

Annotations
@Override
getIdback to summary
public String getId()

Implements jakarta.servlet.http.HttpSession.getId.

Doc from jakarta.servlet.http.HttpSession.getId.

Returns a string containing the unique identifier assigned to this session. The identifier is assigned by the servlet container and is implementation dependent.

Returns:String

a string specifying the identifier assigned to this session

Annotations
@Override
getLastAccessedTimeback to summary
public long getLastAccessedTime()

Implements jakarta.servlet.http.HttpSession.getLastAccessedTime.

Doc from jakarta.servlet.http.HttpSession.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.

Actions that your application takes, such as getting or setting a value associated with the session, do not affect the access time.

Returns:long

a long representing the last time the client sent a request associated with this session, expressed in milliseconds since 1/1/1970 GMT

Annotations
@Override
getMaxInactiveIntervalback to summary
public int getMaxInactiveInterval()

Implements jakarta.servlet.http.HttpSession.getMaxInactiveInterval.

Doc from jakarta.servlet.http.HttpSession.getMaxInactiveInterval.

Returns the maximum time interval, in seconds, that the servlet container will keep this session open between client accesses. After this interval, the servlet container will invalidate the session. The maximum time interval can be set with the setMaxInactiveInterval method. A zero or negative time indicates that the session should never timeout.

Returns:int

an integer specifying the number of seconds this session remains open between client requests

Annotations
@Override
getServletContextback to summary
public ServletContext getServletContext()

Implements jakarta.servlet.http.HttpSession.getServletContext.

Doc from jakarta.servlet.http.HttpSession.getServletContext.

Returns the ServletContext to which this session belongs.

Returns:ServletContext

The ServletContext object for the web application

Annotations
@Override
invalidateback to summary
public void invalidate()

Implements jakarta.servlet.http.HttpSession.invalidate.

Doc from jakarta.servlet.http.HttpSession.invalidate.

Invalidates this session then unbinds any objects bound to it.

Annotations
@Override
isNewback to summary
public boolean isNew()

Implements jakarta.servlet.http.HttpSession.isNew.

Doc from jakarta.servlet.http.HttpSession.isNew.

Returns 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 had disabled the use of cookies, then a session would be new on each request.

Returns:boolean

true if the server has created a session, but the client has not yet joined

Annotations
@Override
removeAttributeback to summary
public void removeAttribute(String name)

Implements jakarta.servlet.http.HttpSession.removeAttribute.

Doc from jakarta.servlet.http.HttpSession.removeAttribute.

Removes the object bound with the specified name from this session. If the session does not have an object bound with the specified name, this method does nothing.

After this method executes, and if the object implements HttpSessionBindingListener, the container calls HttpSessionBindingListener.valueUnbound. The container then notifies any HttpSessionAttributeListeners in the web application.

Parameters
name:String

the name of the object to remove from this session

Annotations
@Override
setAttributeback to summary
public void setAttribute(String name, Object value)

Implements jakarta.servlet.http.HttpSession.setAttribute.

Doc from jakarta.servlet.http.HttpSession.setAttribute.

Binds an object to this session, using the name specified. If an object of the same name is already bound to the session, the object is replaced.

After this method executes, and if the new object implements HttpSessionBindingListener, the container calls HttpSessionBindingListener.valueBound. The container then notifies any HttpSessionAttributeListeners in the web application.

If an object was already bound to this session of this name that implements HttpSessionBindingListener, its HttpSessionBindingListener.valueUnbound method is called.

If the value passed in is null, this has the same effect as calling removeAttribute().

Parameters
name:String

the name to which the object is bound; cannot be null

value:Object

the object to be bound

Annotations
@Override
setMaxInactiveIntervalback to summary
public void setMaxInactiveInterval(int interval)

Implements jakarta.servlet.http.HttpSession.setMaxInactiveInterval.

Doc from jakarta.servlet.http.HttpSession.setMaxInactiveInterval.

Specifies the time, in seconds, between client requests before the servlet container will invalidate this session. A zero or negative time indicates that the session should never timeout.

Parameters
interval:int

An integer specifying the number of seconds

Annotations
@Override