Package org.apache.http.cookie

Examples of org.apache.http.cookie.Cookie


            // expected
        }
    }

    public void testBasicPathParse() throws Exception {
        Cookie cookie = new Cookie("name", "value");
        CookieAttributeHandler h = new BasicPathHandler();
        h.parse(cookie, "stuff");
        assertEquals("stuff", cookie.getPath());
        assertTrue(cookie.isPathAttributeSpecified());
        h.parse(cookie, "");
        assertEquals("/", cookie.getPath());
        assertTrue(cookie.isPathAttributeSpecified());
        h.parse(cookie, null);
        assertEquals("/", cookie.getPath());
        assertTrue(cookie.isPathAttributeSpecified());
    }
View Full Code Here


        assertEquals("/", cookie.getPath());
        assertTrue(cookie.isPathAttributeSpecified());
    }

    public void testBasicPathMatch1() throws Exception {
        Cookie cookie = new Cookie("name", "value");
        CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false);
        CookieAttributeHandler h = new BasicPathHandler();
        cookie.setPath("/stuff");
        assertTrue(h.match(cookie, origin));
    }
View Full Code Here

        cookie.setPath("/stuff");
        assertTrue(h.match(cookie, origin));
    }
   
    public void testBasicPathMatch2() throws Exception {
        Cookie cookie = new Cookie("name", "value");
        CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff/", false);
        CookieAttributeHandler h = new BasicPathHandler();
        cookie.setPath("/stuff");
        assertTrue(h.match(cookie, origin));
    }
View Full Code Here

        cookie.setPath("/stuff");
        assertTrue(h.match(cookie, origin));
    }
   
    public void testBasicPathMatch3() throws Exception {
        Cookie cookie = new Cookie("name", "value");
        CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff/more-stuff", false);
        CookieAttributeHandler h = new BasicPathHandler();
        cookie.setPath("/stuff");
        assertTrue(h.match(cookie, origin));
    }
View Full Code Here

        cookie.setPath("/stuff");
        assertTrue(h.match(cookie, origin));
    }
   
    public void testBasicPathMatch4() throws Exception {
        Cookie cookie = new Cookie("name", "value");
        CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuffed", false);
        CookieAttributeHandler h = new BasicPathHandler();
        cookie.setPath("/stuff");
        assertFalse(h.match(cookie, origin));
    }
View Full Code Here

        cookie.setPath("/stuff");
        assertFalse(h.match(cookie, origin));
    }

    public void testBasicPathMatch5() throws Exception {
        Cookie cookie = new Cookie("name", "value");
        CookieOrigin origin = new CookieOrigin("somehost", 80, "/otherstuff", false);
        CookieAttributeHandler h = new BasicPathHandler();
        cookie.setPath("/stuff");
        assertFalse(h.match(cookie, origin));
    }
View Full Code Here

        cookie.setPath("/stuff");
        assertFalse(h.match(cookie, origin));
    }

    public void testBasicPathMatch6() throws Exception {
        Cookie cookie = new Cookie("name", "value");
        CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false);
        CookieAttributeHandler h = new BasicPathHandler();
        cookie.setPath("/stuff/");
        assertTrue(h.match(cookie, origin));
    }
View Full Code Here

        cookie.setPath("/stuff/");
        assertTrue(h.match(cookie, origin));
    }

    public void testBasicPathMatch7() throws Exception {
        Cookie cookie = new Cookie("name", "value");
        CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false);
        CookieAttributeHandler h = new BasicPathHandler();
        assertTrue(h.match(cookie, origin));
    }
View Full Code Here

        CookieAttributeHandler h = new BasicPathHandler();
        assertTrue(h.match(cookie, origin));
    }

    public void testBasicPathValidate() throws Exception {
        Cookie cookie = new Cookie("name", "value");
        CookieOrigin origin = new CookieOrigin("somehost", 80, "/stuff", false);
        CookieAttributeHandler h = new BasicPathHandler();
        cookie.setPath("/stuff");
        h.validate(cookie, origin);
        cookie.setPath("/stuffed");
        try {
            h.validate(cookie, origin);
            fail("MalformedCookieException must have been thrown");
        } catch (MalformedCookieException ex) {
            // expected
View Full Code Here

            fail("IllegalArgumentException must have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
        try {
            h.match(new Cookie("name", "value"), null);
            fail("IllegalArgumentException must have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.http.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.