BBxWebSession

Description

In BBj 21.00 and higher, the BBxWebSession object provides a way for a BBxServlet to identify a user across more than one page request or visit to a Web site and to store information about that user.

The BBxServlet uses this object to create a session between a client and a server. The session persists for a specified time period, across more than one connection or page request from the user. A session usually corresponds to one user, who may visit a site many times. The server can maintain a session in many ways such as using cookies or rewriting URLs.

This class allows BBxServlets to:

  • View and manipulate information about a session, such as the session identifier, creation time, and last accessed time

  • Bind objects to sessions, allowing user information to persist across multiple user connections

A servlet should be able to handle cases in which the client does not choose to join a session, such as when cookies are intentionally turned off. Until the client joins the session, isNew returns true. If the client chooses not to join the session, getSession will return a different session on each request, and isNew() will always return true.

Session information is scoped only to the current web application (BBxServletContext), so information stored in one context will not be directly visible in another.

Implemented Interfaces

BBxWebSession implements the Java HttpSession interface.

Creation

BBjAPI > BBjAdmin > BBjJettyServerConfiguration > BBjJettyContextConfiguration > BBxServlet > BBxServletContext > BBxWebSession

A BBxWebSession object is created through the following BBxServletContext method:

Return Value Method
BBxWebSession getSession()

Methods of BBxWebSession

Return Value

Method

Object

getAttribute(String name)

BBjVector

getAttributeNames()

BBjJettyContext

getContext()

long

getCreationTime()

String

getId()

long

getLastAccessedTime()

int

getMaxInactiveInterval()

void

invalidate()

boolean

isNew()

void

removeAttribute(String name)

void

setAttribute(String name, Object value)

void

setMaxInactiveInterval(int interval)

See Also

BBxServlet

BBxServlet Tutorial

BBxServletContext::getSession