BBjServletEvent::getHttpRequest (Deprecated)

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

Description

In BBj 12.0 and higher, this method returns the BBjHttpRequest object.

Syntax

Return Value

Method

BBjHttpRequest

getHttpRequest()

Parameters

None.

Return Value

Returns the BBjHttpRequest object.

Remarks

None.

Example

declare BBjServletData data!
data! = BBjAPI().getServletData()
declare PostServlet servlet!
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>"
        print(chan)"<a href = '"+request!.getRequestURI()+"?A = ABC&Z = XYZ'>Get with parameters</a>"

        print(chan)"</body>"
        print(chan)"</html>"
        close(chan)
    methodend
classend

See Also

BBjAPI

BBjServletEvent