BBjspPageContext::getRequest (Deprecated)

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

Description

In BBj 16.0 and higher, this method returns the BBjspWebRequest associated with the BBjspPageContext.

Syntax

Return Value

Method

BBjspWebRequest

getRequest()

Parameters

None.

Return Value

the BBjspWebRequest associated with this context

Remarks

Although you can use this method to get the BBjspWebRequest you should use the build-in field #Request!

Example

This example demonstrates how this works in a BBJSP widget

REM ===
REM === A BBjspWidget that counts page-visits for the user.
REM ===

class public PageCounterWidget implements BBjspWidget

  method public void open(BBjspPageContext context!)

    declare BBjspWebRequest request!
    declare BBjspWebSession session!
    declare BBjspSessionData data!
    declare BBjspLogger logger!
    declare BBjspHashMap visitMap!

    request! = context!.getRequest()
    session! = context!.getSession()
    data! = context!.getBBjspSession()
    logger! = context!.getLogger()

    url$ = request!.getRequestURL()
    
    if !data!.contains("PAGE_VISITS") then
      data!.setAttribute("PAGE_VISITS",BBjAPI().makeBBJSP().makeBBjspHashMap())
    endif
    
    visitMap! = data!.getAttribute("PAGE_VISITS")
    
    ct = 0

    if visitMap!.containsKey(url$) then
      ct = num(visitMap!.get(url$))
    endif

    ct = ct + 1
    visitMap!.put(url$,str(ct))
    
    logger!.log(url$ + " VISIT COUNTER : " + str(ct))
    
    context!.saveBBjspSession()
    
  methodend

classend

See Also

BBJSP

BBjspPageContext

BBjspWebRequest

BBjspHashMap (Deprecated)