BBjHttpResponse::setLocale (Deprecated)

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

Description

In BBj 12.00 and higher, this method sets the locale of the response. It also sets the response's character encoding appropriately for the locale, if the character encoding has not been explicitly set using BBjHttpResponse::setContentType(String) or BBjHttpResponse::setCharacterEncoding(String).

This method may be called repeatedly to change locale and character encoding. It does not set the response's character encoding if it is called after BBjHttpResponse::setContentType(String) has been called with a charset specification or after BBjHttpResponse::setCharacterEncoding(String) has been called.

Syntax

Return Value

Method

void

setLocale(Locale locale)

Parameters

Parameter

Description

locale

the locale of the response

Return Value

None.

Remarks

The example below shows setting a Locale within a BBjServlet.

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()
        response!.setContentType("text/html")
        response.setLocale(new java.lang.Locale("fr", "CA"))
        open (chan)"JSERVLET"
        print (chan)"<html><body><h1>Hello BBj!</h1>"
        print (chan)"Locale:" + str(response!.getLocale())
        print (chan)"</body></html>"
        close (chan)
    methodend
classend

See Also

BBjAPI

BBjServletEvent

BBjHttpResponse::getLocale()