BBjspWebResponse


Creation Path

BBJSP| +--BBjspPageContext| +--BBjspWebResponse

 

Description

In BBj 16.0 and higher, BBjspWebResponse controls how HTTP protocol related data is returned to the client when handling a BBjspWebRequest in the BBJSP framework.

Creation

The BBjspWebResponse is created through the following BBjspPageContext method:

Return Value

Method

BBjspWebResponse

getResponse()

Methods of BBjspWebResponse

Return Value

Method

void

addCookie(BBjCookiecookie)

void

addHeader(string name, string value)

boolean

containsHeader(string name)

BBjCookie

createCookie(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()

ServletOutputStream

getOutputStream()

int

getStatus()

void

sendError(int error)

void

sendError(int error, string message)

void

sendRedirect(string location)

void

setCharacterEncoding(string charset)

void

setContentType(string type)

void

setHeader(string name, string value)

void

setLocale(Locale locale)

void

setStatus(int status)

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

    #response!.setContentType("text/html")
    s! = #response!.getOutputStream()
    
    s!.write("<html><body><h1>Hello from BBJSP</h1>")
    s!.write("</body></html>")
  methodend
classend

See Also

BBJSP

BBjspWebRequest