BBjHttpResponse

Creation

BBjServletEvent

|

+-- BBjHttpResponse

Description

In BBj 12.0 and higher, BBjHttpResponse controls how HTTP protocol related data is returned to the client when handling a BBjServletEvent.

Creation

A BBjHttpResponse object is obtained with the following BBjServletEvent method:

Return Value

Method

BBjHttpResponse

getHttpResponse()

Methods of BBjHttpResponse

Return Value

Method

BBjCookie

addCookie(string name)

void

addHeader(string name, string value)

boolean

containsHeader(string name)

string

encodeRedirectURL(string url)

string

encodeURL(string url)

string

getCharacterEncoding()

string

getContentType()

string

getHeader(string name)

BBjVector

getHeaderNames()

BBjVector

getHeaders(string name)

Locale

getLocale()

int

getStatus()

void

sendError(int errorCode)

void

sendRedirect(string url)

void

setCharacterEncoding(string encoding)

void

setContentType(string mimeType)

void

setFile (string fileName)

void

setHeader(string name, string value)

void

setLocale(Locale locale)

void

setStatus(int code)

Remarks

None.

Example

REM Obtain the instance of the BBjAPI object

LET myAPI!=BBjAPI()

MyServlet! = new MyServlet()

 

data!.setCallback(data!.ON_WEB_CONNECTION, myServlet!, "myMethod")

 

PROCESS_EVENTS

 

class public MyServlet

  method public void myMethod(BBjServletEvent p_event!)

      LET chan = UNT

      request! = p_event!.getHttpRequest()

      response! = p_event!.getHttpResponse()

      resp!.setContentType("text/html")

      open(chan)"JSERVLET"

      print(chan)”<html><body><h1>Hello BBj!”

      close(chan)

  methodend

classend

See Also

BBjAPI

BBjHttpRequest

BBjServletEvent

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.