Package org.asynchttpclient.cookie

Examples of org.asynchttpclient.cookie.Cookie


            h.add("Test2", "Test2");
            h.add("Test3", "Test3");
            h.add("Test4", "Test4");
            h.add("Test5", "Test5");

            final Cookie coo = Cookie.newValidCookie("foo", "value", "value", "/", "/", -1L, -1, false, false);
            client.prepareGet(getTargetUrl()).setHeaders(h).addCookie(coo).execute(new AsyncCompletionHandlerAdapter() {

                @Override
                public Response onCompleted(Response response) throws Exception {
                    try {
View Full Code Here


        }

        if (isNonEmpty(setCookieHeaders)) {
            List<Cookie> cookies = new ArrayList<Cookie>();
            for (String value : setCookieHeaders) {
                Cookie c = CookieDecoder.decode(value, timeConverter);
                if (c != null)
                    cookies.add(c);
            }
            return Collections.unmodifiableList(cookies);
        }
View Full Code Here

                    }

                    logger.debug("Redirecting to {}", newUrl);

                    for (String cookieStr : responseHeaders.getAll(HttpHeaders.Names.SET_COOKIE)) {
                        Cookie c = CookieDecoder.decode(cookieStr, timeConverter);
                        if (c != null)
                            requestBuilder.addOrReplaceCookie(c);
                    }

                    requestBuilder.setHeaders(propagatedHeaders(future.getRequest()));
View Full Code Here

        if (!ctx.getProvider().getClientConfig().isRemoveQueryParamOnRedirect())
            builder.addQueryParams(ctx.getRequest().getQueryParams());
       
        if (response.getHeader(Header.Cookie) != null) {
            for (String cookieStr : response.getHeaders().values(Header.Cookie)) {
                Cookie c = CookieDecoder.decode(cookieStr);
                if (c != null) {
                    builder.addOrReplaceCookie(c);
                }
            }
        }
View Full Code Here

        final org.glassfish.grizzly.http.Cookie[] grizzlyCookies = cookies.get();
        List<Cookie> convertedCookies = new ArrayList<Cookie>(grizzlyCookies.length);
        for (int i = 0, len = grizzlyCookies.length; i < len; i++) {
            org.glassfish.grizzly.http.Cookie gCookie = grizzlyCookies[i];
            convertedCookies.add(new Cookie(gCookie.getName(), gCookie.getValue(), gCookie.getValue(), gCookie.getDomain(), gCookie
                    .getPath(), -1L, gCookie.getMaxAge(), gCookie.isSecure(), gCookie.isHttpOnly()));
        }
        return Collections.unmodifiableList(convertedCookies);
    }
View Full Code Here

        }, null, null);

        List<Cookie> cookies = response.getCookies();
        assertEquals(cookies.size(), 1);

        Cookie cookie = cookies.get(0);
        long originalDateWith1SecPrecision = date.getTime() / 1000 * 1000;
        assertEquals(cookie.getExpires(), originalDateWith1SecPrecision);
    }
View Full Code Here

            }
        }, null, null);
        List<Cookie> cookies = response.getCookies();
        assertEquals(cookies.size(), 1);

        Cookie cookie = cookies.get(0);
        assertEquals(cookie.getMaxAge(), 60);
    }
View Full Code Here

        }, null, null);

        List<Cookie> cookies = response.getCookies();
        assertEquals(cookies.size(), 1);

        Cookie cookie = cookies.get(0);
        assertEquals(cookie.getMaxAge(), -1);
    }
View Full Code Here

        try {
            RequestBuilder builder2 = new RequestBuilder("GET");
            builder2.setFollowRedirect(true);
            builder2.setUrl("http://www.google.com/");
            builder2.addHeader("Content-Type", "text/plain");
            builder2.addCookie(new Cookie("evilcookie", "test", "test", ".google.com", "/", -1L, 10, false, false));
            Request request2 = builder2.build();
            Response response = c.executeRequest(request2).get();

            assertNotNull(response);
            assertEquals(response.getStatusCode(), 200);
View Full Code Here

TOP

Related Classes of org.asynchttpclient.cookie.Cookie

Copyright © 2018 www.massapicom. 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.