Package org.apache.http

Examples of org.apache.http.Header$BufferedHeader


    /**
     * Tests Netscape specific cookie formatting.
     */
    public void testNetscapeCookieFormatting() throws Exception {
        Header header = new BasicHeader(
          "Set-Cookie", "name=value; path=/; domain=.mydomain.com");
        CookieSpec cookiespec = new NetscapeDraftSpec();
        CookieOrigin origin = new CookieOrigin("myhost.mydomain.com", 80, "/", false);
        List<Cookie> cookies = cookiespec.parse(header, origin);
        cookiespec.validate(cookies.get(0), origin);
View Full Code Here


    /**
     * Tests Netscape specific expire attribute parsing.
     */
    public void testNetscapeCookieExpireAttribute() throws Exception {
        CookieSpec cookiespec = new NetscapeDraftSpec();
        Header header = new BasicHeader("Set-Cookie",
            "name=value; path=/; domain=.mydomain.com; expires=Thu, 01-Jan-2070 00:00:10 GMT; comment=no_comment");
        CookieOrigin origin = new CookieOrigin("myhost.mydomain.com", 80, "/", false);
        List<Cookie> cookies = cookiespec.parse(header, origin);
        cookiespec.validate(cookies.get(0), origin);
        header = new BasicHeader("Set-Cookie",
View Full Code Here

    /**
     * Tests Netscape specific expire attribute without a time zone.
     */
    public void testNetscapeCookieExpireAttributeNoTimeZone() throws Exception {
        CookieSpec cookiespec = new NetscapeDraftSpec();
        Header header = new BasicHeader("Set-Cookie",
            "name=value; expires=Thu, 01-Jan-2006 00:00:00 ");
        CookieOrigin origin = new CookieOrigin("myhost.mydomain.com", 80, "/", false);
        try {
            cookiespec.parse(header, origin);
            fail("MalformedCookieException should have been thrown");
View Full Code Here

   
    /**
     * Tests if cookie values with embedded comma are handled correctly.
     */
    public void testCookieWithComma() throws Exception {
        Header header = new BasicHeader("Set-Cookie", "a=b,c");

        CookieSpec cookiespec = new NetscapeDraftSpec();
        CookieOrigin origin = new CookieOrigin("localhost", 80, "/", false);
        List<Cookie> cookies = cookiespec.parse(header, origin);
        assertEquals("number of cookies", 1, cookies.size());
View Full Code Here

                    needVersionHeader = true;
                }
            }

            if (needVersionHeader) {
                Header header = cookieSpec.getVersionHeader();
                if (header != null) {
                    // Advertise cookie version support
                    request.addHeader(header);
                }
            }
View Full Code Here

            final HeaderIterator iterator,
            final CookieSpec cookieSpec,
            final CookieOrigin cookieOrigin,
            final CookieStore cookieStore) {
        while (iterator.hasNext()) {
            Header header = iterator.nextHeader();
            try {
                List<Cookie> cookies = cookieSpec.parse(header, cookieOrigin);
                for (Cookie cookie : cookies) {
                    try {
                        cookieSpec.validate(cookie, cookieOrigin);
View Full Code Here

            e2.consumeContent();
        }
       
        HttpRequest reqWrapper = (HttpRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
       
        Header cookiesupport = reqWrapper.getFirstHeader("Cookie2");
        assertNotNull(cookiesupport);
        assertEquals("$Version=1", cookiesupport.getValue());
    }
View Full Code Here

            e2.consumeContent();
        }
       
        HttpRequest reqWrapper = (HttpRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
       
        Header cookiesupport = reqWrapper.getFirstHeader(SM.COOKIE2);
        assertNotNull(cookiesupport);
        assertEquals("$Version=1", cookiesupport.getValue());
    }
View Full Code Here

            e2.consumeContent();
        }
       
        HttpRequest reqWrapper = (HttpRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
       
        Header cookiesupport = reqWrapper.getFirstHeader("Cookie2");
        assertNotNull(cookiesupport);
        assertEquals("$Version=1", cookiesupport.getValue());
    }
View Full Code Here

        CookieSpec cookiespec = new BestMatchSpec();
        CookieOrigin origin = new CookieOrigin("a.b.domain.com", 80, "/", false);

        // Make sure the lenient (browser compatible) cookie parsing
        // and validation is used for Netscape style cookies
        Header header = new BasicHeader("Set-Cookie", "name=value;path=/;domain=domain.com");

        List<Cookie> cookies = cookiespec.parse(header, origin);
        for (int i = 0; i < cookies.size(); i++) {
            cookiespec.validate(cookies.get(i), origin);
        }
View Full Code Here

TOP

Related Classes of org.apache.http.Header$BufferedHeader

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.