BBjspWebSession (Deprecated)

The BBJSP system is deprecated. For new development, use BBxServlet.

Description

Provides a way to identify a user across more than one page request or visit to a Web site and to store information about that user.

The servlet container uses this interface to create a session between an HTTP client and an HTTP 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 session is maintained using a cookie.

This interface allows servlets 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

Creation

BBJSP > BBjspPageContext > BBjspWebSession

The BBjspWebSession is created through the following BBjspPageContext method:

Return Value

Method

BBjspWebSession

getSession()

Methods of BBjspWebSession

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)

Example

This example demonstrates how this works in a BBJSP servlet

class public MyServlet

  field private BBjspWebRequest request!
  field private BBjspWebResponse response!
  field private BBjspWebSession session!
  
  method public void service(BBjspServletContext context!)
       
    #request! = context!.getRequest()
    #response! = context!.getResponse()

    #session! = #request!.getSession()
    s! = #response!.getOutputStream()
    
    #response!.setContentType("text/html")
    
    s!.write("<html><body><h1>Hello from BBJSP</h1>")
    s!.write("Session ID:"+ session!.getId())
    s!.write("</body></html>")
  methodend
classend

See Also

BBJSP

BBjspWebRequest

BBjspSessionUtil