BBjServletEvent::getHttpResponse (Deprecated)

BBjServletEvent::getHttpResponse is deprecated for BBj 21.00 and higher, and has been replaced by BBxServletContext::getResponse.

Description

In BBj 12.00 and higher, this method returns the BBjHttpResponse object.

Syntax

Return Value

Method

BBjHttpResponse

getHttpResponse()

Parameters

None.

Return Value

Returns the BBjHttpResponse object.

Remarks

None.

Example

declare BBjServletData data!
declare PostServlet servlet!
data! = BBjAPI().getServletData()
servlet! = new PostServlet()
data!.setCallback(data!.ON_WEB_CONNECTION, servlet!, "myMethod")
process_events
class public PostServlet
    method public void myMethod(BBjServletEvent p_event!)
        let chan = UNT
        request! = p_event!.getHttpRequest()
        session! = request!.getSession()
        context! = session!.getContext()
        response! = p_event!.getHttpResponse()
        response!.setContentType("text/html")
        open (chan)"JSERVLET"
        print (chan)"<html>"
        print (chan)"<body>"
        print (chan)"<h1>Hello BBj!</h1>"
        vect! = request!.getParameterNames()
        if (vect!.size()) then
            print (chan)"<hr><b>PARAMETERS</b><br>"
            for i = 0 to vect!.size()-1
                name$ = vect!.get(i)
                value$ = request!.getParameter(name$)
                print (chan)name$ + " = " + value$ + "<br>"
            next i
        endif
        print (chan)"<hr>METHOD:" + request!.getMethod()
        print (chan)"<hr>BODY<br>" + str(request!.getBody()) + "<hr>"
        print (chan)"<form method = 'POST'>"
        print (chan)"<input name = 'p1' />"
        print (chan)"<input name = 'p2' />"
        print (chan)"<input name = 'p3' />"
        print (chan)"<input type = 'submit' value = 'Post Form' />"
        print (chan)"</form>"
        print (chan)"<hr>"
        a$ = "<a href = '"+request!.getRequestURI()+"?A = ABC&Z = XYZ'>"
        a$ = a$ + "Get with parameters</a>"
        print (chan)a$
        print (chan)"</body>"
        print (chan)"</html>"
        close (chan)
    methodend
classend

See Also

BBjAPI

BBjServletEvent