BBjspWebSession::getContext (Deprecated)

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

Description

In BBj 16.0 and higher,this method gets the BBjJettyContext for this session.

Syntax

Return Value

Method

BBjJettyContext

getContext()

Parameters

None.

Return Value

the BBjJettyContext for the current session

Remarks

The BBjJettyContext contains parameters and attributes that can be used to enhance your BBjServlet application(s).

Example

This example demonstrates how this works in a BBJSP web-page

<html>
    <body>
        <h1>Hello from BBJSP</h1>
        CONTEXT: <%= #getSession().getContext().getContextName() %>
    </body>
</html>

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>")
    context! = session!.getContext())
    s!.write("CONTEXT NAME:" + context!.getContextName())
    s!.write("</body></html>")
  methodend
classend

See Also

BBjspWebSession