Multiple choice technology security

What is the method name of the Java Class "Cookie" to be used to indicate to the browser whether the cookie should only be sent using a secure protocol, such as HTTPS or SSL?

  1. setSSL()

  2. setCookieSSL()

  3. setCookieSecure()

  4. setSecure()

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The Java javax.servlet.http.Cookie class provides the setSecure(boolean flag) method to signal to the browser that the cookie should only be sent over secure protocols like HTTPS. Other options like setSSL, setCookieSSL, and setCookieSecure do not exist in the standard Servlet API.