Java HttpCookie getSecure() 方法

2025年3月22日 | 阅读1分钟

Java HttpCookie 类的 getSecure() 方法用于检查是否仅允许通过安全协议传输 Cookie。如果限制通过安全协议传输 Cookie,则该方法返回 true。否则,该方法可能返回 true,表示可以使用任何协议进行传输。

语法

参数

不适用。

返回

如果 Cookie 可以通过任何其他标准协议发送,则上述方法返回 false。否则,该方法可能返回 true。

示例 1

输出

Tests whether the cookie can be sent through secured protocol or not: false

示例 2

输出

Tests whether the cookie can be sent through secured protocol or not: true
下一主题getValue() 方法