BBjHttpResponse (Deprecated)

BBjHttpResponse is deprecated for BBj 21.00 and higher, and has been replaced by BBxServletResponse.

Description

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

Creation

BBjServletEvent > BBjHttpResponse

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 error)

void sendError(int error, string msg

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(BBjServletEventp_event!)
        LETchan = UNT
        request!= p_event!.getHttpRequest()
        response!= p_event!.getHttpResponse()
        resp!.setContentType("text/html")
        open(chan)"JSERVLET"
        print(chan)”<html><body><h1>HelloBBj!”
        close(chan)
    methodend
classend

See Also

BBjAPI

BBjHttpRequest

BBjServletEvent

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