Example usage for java.net HttpCookie setHttpOnly

List of usage examples for java.net HttpCookie setHttpOnly

Introduction

In this page you can find the example usage for java.net HttpCookie setHttpOnly.

Prototype

public void setHttpOnly(boolean httpOnly) 

Source Link

Document

Indicates whether the cookie should be considered HTTP Only.

Usage

From source file:keywhiz.cli.JsonCookie.java

public static HttpCookie toHttpCookie(JsonCookie cookieContents) {
    HttpCookie cookie = new HttpCookie(cookieContents.name(), cookieContents.value());
    cookie.setDomain(cookieContents.domain());
    cookie.setPath(cookieContents.path());
    cookie.setSecure(cookieContents.isSecure());
    cookie.setHttpOnly(cookieContents.isHttpOnly());
    cookie.setVersion(1); // Always set version to 1 or important fields will be dropped
    return cookie;
}