public HttpCookie toHttpCookie() {
   HttpCookie cookie = new HttpCookie(name, value);
   cookie.setComment(comment);
   cookie.setCommentURL(commentURL);
   cookie.setDiscard(discard);
   cookie.setDomain(domain);
   cookie.setMaxAge((expiry - System.currentTimeMillis()) / 1000L);
   cookie.setPath(path);
   cookie.setPortlist(portList);
   cookie.setSecure(secure);
   cookie.setVersion(version);
   return cookie;
 }
Example #2
0
  public static HttpCookie fromNewCookie(NewCookie c) {

    HttpCookie cookie = new HttpCookie(c.getName(), c.getValue());

    cookie.setComment(c.getComment());
    cookie.setCommentURL("not available");
    cookie.setDiscard(false);
    cookie.setDomain(c.getDomain());
    cookie.setMaxAge(c.getMaxAge());
    cookie.setPath(c.getPath());
    cookie.setPortlist("not available");
    cookie.setSecure(c.isSecure());
    cookie.setVersion(c.getVersion());
    cookie.setHttpOnly(c.isHttpOnly());

    return cookie;
  }