BBjspWebRequest::isSecure (Deprecated)

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

Description

In BBj 16.0 and higher, this method returns a boolean indicating whether this BBjspWebRequest was made using a secure channel, such as HTTPS.

Syntax

Return Value

Method

boolean

isSecure()

Parameters

None.

Return Value

a boolean where 0 = request was not made with a secure channel and 1 = request was made with a secure channel.

Remarks

The example below shows testing to see if the request was secure within a BBJSP Servlet.

Example

This example demonstrates how this works in a BBJSP web-page

<%@ taglib uri='/WEB-CFG/tld/core.tld' prefix='c' %>
<html>
    <body>
        <h1>Hello from BBJSP</h1>
        The connection is
        <c:if test='<%= #getRequest().isSecure() %>' >
            SECURE
        </c:if>
        <c:ifnot test='<%= #getRequest().isSecure() %>' >
            INSECURE
        </c:ifnot>
    </body>
</html>

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>")
    if #request!.isSecure()
      s!.write("SECURE CONNECTION")
    else
      s!.write("INSECURE CONNECTION")
    endif
    s!.write("</body></html>")
  methodend
classend

See Also

BBJSP

BBjspWebRequest