Example usage for java.net HttpCookie getPortlist

List of usage examples for java.net HttpCookie getPortlist

Introduction

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

Prototype

public String getPortlist() 

Source Link

Document

Returns the port list 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.getPortlist());
        System.out.println();//from   w w w. j av  a2  s  .c o m
    }
}

From source file:java.net.HttpCookie.java

/**
 * Returns true if {@code cookie} should be sent to {@code uri} with respect to the cookie's
 * port list.//ww w .j  a v  a  2 s.c om
 */
static boolean portMatches(HttpCookie cookie, URI uri) {
    if (cookie.getPortlist() == null) {
        return true;
    }
    return Arrays.asList(cookie.getPortlist().split(",")).contains(Integer.toString(uri.getEffectivePort()));
}

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

public Cookie(final HttpCookie cookie) {
    name = cookie.getName();//w  ww .ja v  a  2 s.  c o m
    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:org.openhab.binding.amazonechocontrol.internal.Connection.java

public String serializeLoginData() {
    Date loginTime = this.loginTime;
    if (refreshToken == null || loginTime == null) {
        return "";
    }//from   w  w  w  . j ava2s .  c om
    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();
}