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

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

Introduction

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

Prototype

void setComment(String comment);

Source Link

Document

If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described using this comment.

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 {//w w w .j  av  a  2s  . 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;
}