Package org.restlet.engine.header

Examples of org.restlet.engine.header.CookieReader


            if (getHeaders() != null) {
                String cookieValues = getHeaders().getValues(
                        HeaderConstants.HEADER_COOKIE);

                if (cookieValues != null) {
                    new CookieReader(cookieValues).addValues(result);
                }
            }

            this.cookiesAdded = true;
        }
View Full Code Here


        if (!this.cookiesAdded) {
            String cookieValues = getHttpCall().getRequestHeaders().getValues(
                    HeaderConstants.HEADER_COOKIE);

            if (cookieValues != null) {
                new CookieReader(cookieValues).addValues(result);
            }

            this.cookiesAdded = true;
        }
View Full Code Here

     * @param headerValue
     *            The cookie header value.
     * @throws IOException
     */
    private void testCookie(String headerValue) throws IOException {
        CookieReader cr = new CookieReader(headerValue);
        List<Cookie> cookies = new ArrayList<Cookie>();
        Cookie cookie = cr.readValue();

        while (cookie != null) {
            cookies.add(cookie);
            cookie = cr.readValue();
        }

        // Rewrite the header
        String newHeaderValue = CookieWriter.write(cookies);

View Full Code Here

     * @param headerValue
     *            The cookie header value.
     * @throws IOException
     */
    private void testCookieValues(String headerValue) throws IOException {
        CookieReader cr = new CookieReader(headerValue);
        List<Cookie> cookies = new ArrayList<Cookie>();
        Cookie cookie = cr.readValue();
        while (cookie != null) {
            cookies.add(cookie);
            cookie = cr.readValue();
        }

        // Rewrite the header
        String newHeaderValue = CookieWriter.write(cookies);

        // Reparse
        List<Cookie> cookies2 = new ArrayList<Cookie>();
        cr = new CookieReader(newHeaderValue);
        cookie = cr.readValue();
        while (cookie != null) {
            cookies2.add(cookie);
            cookie = cr.readValue();
        }

        // Compare initial and new cookies
        assertEquals(cookies.size(), cookies2.size());
        for (int i = 0; i < cookies.size(); i++) {
View Full Code Here

            if (getHeaders() != null) {
                String cookieValues = getHeaders().getValues(
                        HeaderConstants.HEADER_COOKIE);

                if (cookieValues != null) {
                    new CookieReader(cookieValues).addValues(result);
                }
            }

            this.cookiesAdded = true;
        }
View Full Code Here

TOP

Related Classes of org.restlet.engine.header.CookieReader

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.