Example usage for java.net HttpCookie getDiscard

List of usage examples for java.net HttpCookie getDiscard

Introduction

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

Prototype

public boolean getDiscard() 

Source Link

Document

Returns the discard attribute of the cookie

Usage

From source file:Main.java

public static void main(String[] args) throws Exception {
    CookieManager cm = new CookieManager();
    cm.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
    CookieHandler.setDefault(cm);

    new URL("http://google.com").openConnection().getContent();

    List<HttpCookie> cookies = cm.getCookieStore().getCookies();
    for (HttpCookie cookie : cookies) {
        System.out.println(cookie.getDiscard());
        System.out.println();/*from w  ww . j a v a2  s.  c  o  m*/
    }
}

From source file:at.becast.youploader.youtube.data.Cookie.java

public Cookie(final HttpCookie cookie) {
    name = cookie.getName();// ww  w . ja v  a 2s . com
    value = cookie.getValue();
    comment = cookie.getComment();
    commentUrl = cookie.getCommentURL();
    domain = cookie.getDomain();
    discard = cookie.getDiscard();
    maxAge = cookie.getMaxAge();
    path = cookie.getPath();
    portList = cookie.getPortlist();
    secure = cookie.getSecure();
    version = cookie.getVersion();
}

From source file:com.nominanuda.web.http.ServletHelper.java

public Cookie servletCookie(HttpCookie c) {
    Cookie _c = new Cookie(c.getName(), c.getValue());
    if (c.getComment() != null) {
        _c.setComment(c.getComment());/*from  ww  w.  j  a v a  2  s.  c  o  m*/
    }
    if (c.getDomain() != null) {
        _c.setDomain(c.getDomain());
    }
    if (c.getPath() != null) {
        _c.setPath(c.getPath());
    }
    _c.setSecure(c.getSecure());
    _c.setVersion(c.getVersion());
    _c.setHttpOnly(c.getDiscard());
    _c.setMaxAge((int) c.getMaxAge());
    return _c;
}

From source file:org.openhab.binding.amazonechocontrol.internal.Connection.java

public String serializeLoginData() {
    Date loginTime = this.loginTime;
    if (refreshToken == null || loginTime == null) {
        return "";
    }/*from  w  w  w  .ja  v a2s  . c o  m*/
    StringBuilder builder = new StringBuilder();
    builder.append("6\n"); // version
    builder.append(frc);
    builder.append("\n");
    builder.append(serial);
    builder.append("\n");
    builder.append(deviceId);
    builder.append("\n");
    builder.append(refreshToken);
    builder.append("\n");
    builder.append(amazonSite);
    builder.append("\n");
    builder.append(deviceName);
    builder.append("\n");
    builder.append(accountCustomerId);
    builder.append("\n");
    builder.append(loginTime.getTime());
    builder.append("\n");
    List<HttpCookie> cookies = cookieManager.getCookieStore().getCookies();
    builder.append(cookies.size());
    builder.append("\n");
    for (HttpCookie cookie : cookies) {
        writeValue(builder, cookie.getName());
        writeValue(builder, cookie.getValue());
        writeValue(builder, cookie.getComment());
        writeValue(builder, cookie.getCommentURL());
        writeValue(builder, cookie.getDomain());
        writeValue(builder, cookie.getMaxAge());
        writeValue(builder, cookie.getPath());
        writeValue(builder, cookie.getPortlist());
        writeValue(builder, cookie.getVersion());
        writeValue(builder, cookie.getSecure());
        writeValue(builder, cookie.getDiscard());
    }
    return builder.toString();
}