Examples of HttpCookie


Examples of java.net.HttpCookie

                Assert.assertNotNull(values);
                Assert.assertEquals(1, values.size());

                List<HttpCookie> cookies = HttpCookie.parse(values.get(0));
                Assert.assertEquals(1, cookies.size());
                HttpCookie cookie = cookies.get(0);
                Assert.assertEquals(cookieName, cookie.getName());
                Assert.assertEquals(cookieValue, cookie.getValue());
                Assert.assertEquals(cookieDomain, cookie.getDomain());
                Assert.assertEquals(cookiePath, cookie.getPath());
            }
        });
        ClientEndpointConfig config = builder.build();

        Endpoint endPoint = new Endpoint()
View Full Code Here

Examples of java.net.HttpCookie

    {
        HttpClient client = new HttpClient();
        client.start();

        // Set a cookie to be sent in requests that match the cookie's domain
        client.getCookieStore().add(URI.create("http://host:8080/path"), new HttpCookie("name", "value"));

        // Send a request for the cookie's domain
        Response response = client.newRequest("host", 8080).send();

        Assert.assertEquals(200, response.getStatus());
View Full Code Here

Examples of java.net.HttpCookie

        if (requestCookies != null)
        {
            List<HttpCookie> cookies = new ArrayList<>();
            for (Cookie requestCookie : requestCookies)
            {
                HttpCookie cookie = new HttpCookie(requestCookie.getName(), requestCookie.getValue());
                // No point handling domain/path/expires/secure/httponly on client request cookies
                cookies.add(cookie);
            }
            setCookies(cookies);
        }
View Full Code Here

Examples of java.net.HttpCookie

         this(cookie, cookie.getMaxAge(), creationTime);
      }

      public Cookie(String name, String value, int secondsBeforeExpiration)
      {
         this(new HttpCookie(name, value), secondsBeforeExpiration, System.currentTimeMillis());
      }
View Full Code Here

Examples of java.net.HttpCookie

                List<HttpCookie> indexedCookies = cookieIndex.get(index);
                // check the list of cookies associated with this domain
                if (indexedCookies != null) {
                    Iterator<HttpCookie> it = indexedCookies.iterator();
                    while (it.hasNext()) {
                        HttpCookie ck = it.next();
                        if (cookieJar.indexOf(ck) != -1) {
                            // the cookie still in main cookie store
                            if (!ck.hasExpired()) {
                                // don't add twice
                                if (!cookies.contains(ck))
                                    cookies.add(ck);
                            } else {
                                it.remove();
View Full Code Here

Examples of java.net.HttpCookie

        }
    }

    // check name
    TestHttpCookie n(int index, String n) {
        HttpCookie cookie = cookies.get(index);
        if (cookie == null || !n.equalsIgnoreCase(cookie.getName())) {
            raiseError("name", cookie.getName(), n);
        }

        return this;
    }
View Full Code Here

Examples of java.net.HttpCookie

    }
    TestHttpCookie n(String n) { return n(0, n); }

    // check value
    TestHttpCookie v(int index, String v) {
        HttpCookie cookie = cookies.get(index);
        if (cookie == null || !v.equals(cookie.getValue())) {
            raiseError("value", cookie.getValue(), v);
        }

        return this;
    }
View Full Code Here

Examples of java.net.HttpCookie

    }
    TestHttpCookie v(String v) { return v(0, v); }

    // check version
    TestHttpCookie ver(int index, int ver) {
        HttpCookie cookie = cookies.get(index);
        if (cookie == null || (ver != cookie.getVersion())) {
            raiseError("version", Integer.toString(cookie.getVersion()), Integer.toString(ver));
        }

        return this;
    }
View Full Code Here

Examples of java.net.HttpCookie

    }
    TestHttpCookie ver(int ver) { return ver(0, ver); }

    // check path
    TestHttpCookie p(int index, String p) {
        HttpCookie cookie = cookies.get(index);
        if (cookie == null || !p.equals(cookie.getPath())) {
            raiseError("path", cookie.getPath(), p);
        }

        return this;
    }
View Full Code Here

Examples of java.net.HttpCookie

        return this;
    }

    // check comment
    TestHttpCookie c(int index, String c) {
        HttpCookie cookie = cookies.get(index);
        if (cookie == null || !c.equals(cookie.getComment())) {
            raiseError("comment", cookie.getComment(), c);
        }

        return this;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.