Example usage for org.apache.http.cookie SetCookie setSecure

List of usage examples for org.apache.http.cookie SetCookie setSecure

Introduction

In this page you can find the example usage for org.apache.http.cookie SetCookie setSecure.

Prototype

void setSecure(boolean secure);

Source Link

Document

Sets the secure attribute of the cookie.

Usage

From source file:org.nextlets.erc.defaults.http.ERCHttpInvokerImpl.java

private Cookie toCookie(URI uri, HttpCookie httpCookie) {
    SetCookie cookie = new BasicClientCookie(httpCookie.getName(), httpCookie.getValue());
    cookie.setComment(httpCookie.getComment());
    if (httpCookie.getDomain() != null) {
        cookie.setDomain(httpCookie.getDomain());
    } else {//from   www . j  a  v  a2  s .  c o m
        cookie.setDomain(uri.getHost());
    }
    if (httpCookie.getMaxAge() != -1) {
        cookie.setExpiryDate(new Date(httpCookie.getMaxAge() * 1000));
    }
    if (httpCookie.getPath() != null) {
        cookie.setPath(httpCookie.getPath());
    } else {
        cookie.setPath(uri.getPath());
    }
    cookie.setSecure(httpCookie.getSecure());
    cookie.setVersion(httpCookie.getVersion());
    return cookie;
}