BBjspRequestUtil::findCookieValue (Deprecated)

The BBJSP system is deprecated. For new development, use BBxServlet.

Description

In BBJ 16.0 and higher, this method gets the value of the specified cookie.

Syntax

Return Value

Method

String

findCookieValue(BBjspWebRequest request, string cookieName)

Parameters

Variable

Description

cookieName

the cookie name

request

the request

Return Value

the value of the cookie

Remarks

None.

Example

CLASS PUBLIC MyServlet

    rem '===
    rem '=== You must implement this method as it is the main execution point.
    rem '===
    METHOD PUBLIC void service(BBjspServletContext context!)
        declare BBjspWebRequest request!
        declare BBjspWebResponse response!
        declare BBjspSessionData data!

        request! = context!.getRequest()
        response! = context!.getResponse()
        data! = context!.getBBjspSession()

        cookieValue$ = BBjspRequestUtil.findCookieValue(request!,"MyCookie")

        if (cookieValue$ = "") then
            declare BBjCookie cookie!
            cookie! = response!.addCookie("MyCookie")
            cookie!.setValue("some-value")
        endif

        s! = response!.getOutputStream()
        s!.write("<html>")
        s!.write("<body>")
        s!.write("<h1>OK</h1>")
        s!.write("</body>")
        s!.write("</html>")

    METHODEND

CLASSEND

See Also