Package org.apache.http.cookie

Examples of org.apache.http.cookie.ClientCookie.containsAttribute()


        final List<Cookie> cookies = cookiespec.parse(header, origin);
        Assert.assertNotNull(cookies);
        Assert.assertEquals(1, cookies.size());
        final ClientCookie cookie = (ClientCookie) cookies.get(0);
        Assert.assertEquals("/", cookie.getPath());
        Assert.assertTrue(cookie.containsAttribute(ClientCookie.PATH_ATTR));
    }

    @Test
    public void testParseBlankPath() throws Exception {
        final CookieSpec cookiespec = new RFC2965Spec();
View Full Code Here


        final List<Cookie> cookies = cookiespec.parse(header, origin);
        Assert.assertNotNull(cookies);
        Assert.assertEquals(1, cookies.size());
        final ClientCookie cookie = (ClientCookie) cookies.get(0);
        Assert.assertEquals("/", cookie.getPath());
        Assert.assertTrue(cookie.containsAttribute(ClientCookie.PATH_ATTR));
    }

    /**
     * Test parsing cookie {@code "Domain"} attribute.
     */
 
View Full Code Here

        Assert.assertNotNull(cookies);
        Assert.assertEquals(1, cookies.size());
        // only the first occurrence of domain attribute is considered, others ignored
        ClientCookie cookie = (ClientCookie) cookies.get(0);
        Assert.assertEquals(".domain.com", cookie.getDomain());
        Assert.assertTrue(cookie.containsAttribute(ClientCookie.DOMAIN_ATTR));

        // should put a leading dot if there is no dot in front of domain
        header = new BasicHeader("Set-Cookie2", "name=value;Domain=domain.com;Version=1");
        cookies = cookiespec.parse(header, origin);
        Assert.assertNotNull(cookies);
View Full Code Here

        final List<Cookie> cookies = cookiespec.parse(header, origin);
        Assert.assertNotNull(cookies);
        Assert.assertEquals(1, cookies.size());
        final ClientCookie cookie = (ClientCookie) cookies.get(0);
        Assert.assertEquals("www.domain.com", cookie.getDomain());
        Assert.assertFalse(cookie.containsAttribute(ClientCookie.DOMAIN_ATTR));
    }

    @Test
    public void testParseNullDomain() throws Exception {
        final CookieSpec cookiespec = new RFC2965Spec();
View Full Code Here

        Assert.assertNotNull(ports);
        Assert.assertEquals(3, ports.length);
        Assert.assertEquals(80, ports[0]);
        Assert.assertEquals(800, ports[1]);
        Assert.assertEquals(8000, ports[2]);
        Assert.assertTrue(cookie.containsAttribute(ClientCookie.PORT_ATTR));
    }

    @Test
    public void testParsePortDefault() throws Exception {
        final CookieSpec cookiespec = new RFC2965Spec();
View Full Code Here

        final Header header = new BasicHeader("Set-Cookie2", "name=value;Version=1");
        final List<Cookie> cookies = cookiespec.parse(header, origin);
        Assert.assertNotNull(cookies);
        Assert.assertEquals(1, cookies.size());
        final ClientCookie cookie = (ClientCookie) cookies.get(0);
        Assert.assertFalse(cookie.containsAttribute(ClientCookie.PORT_ATTR));
    }

    @Test
    public void testParseNullPort() throws Exception {
        final CookieSpec cookiespec = new RFC2965Spec();
View Full Code Here

        final List<Cookie> cookies = cookiespec.parse(header, origin);
        Assert.assertNotNull(cookies);
        Assert.assertEquals(1, cookies.size());
        final ClientCookie cookie = (ClientCookie) cookies.get(0);
        Assert.assertEquals(1, cookie.getVersion());
        Assert.assertTrue(cookie.containsAttribute(ClientCookie.VERSION_ATTR));
    }

    @Test
    public void testParseNullVersion() throws Exception {
        final CookieSpec cookiespec = new RFC2965Spec();
View Full Code Here

        assertNotNull(cookies);
        assertEquals(1, cookies.size());
        // only the first occurrence of path attribute is considered, others ignored
        ClientCookie cookie = (ClientCookie) cookies.get(0);
        assertEquals("/", cookie.getPath());
        assertTrue(cookie.containsAttribute(ClientCookie.PATH_ATTR));
    }

    public void testParsePathDefault() throws Exception {
        CookieSpec cookiespec = new RFC2965Spec();
        CookieOrigin origin = new CookieOrigin("www.domain.com", 80, "/path/", false);
View Full Code Here

        List<Cookie> cookies = cookiespec.parse(header, origin);
        assertNotNull(cookies);
        assertEquals(1, cookies.size());
        ClientCookie cookie = (ClientCookie) cookies.get(0);
        assertEquals("/path", cookie.getPath());
        assertFalse(cookie.containsAttribute(ClientCookie.PATH_ATTR));
    }

    public void testParseNullPath() throws Exception {
        CookieSpec cookiespec = new RFC2965Spec();
        CookieOrigin origin = new CookieOrigin("www.domain.com", 80, "/", false);
View Full Code Here

        List<Cookie> cookies = cookiespec.parse(header, origin);
        assertNotNull(cookies);
        assertEquals(1, cookies.size());
        ClientCookie cookie = (ClientCookie) cookies.get(0);
        assertEquals("/", cookie.getPath());
        assertTrue(cookie.containsAttribute(ClientCookie.PATH_ATTR));
    }

    public void testParseBlankPath() throws Exception {
        CookieSpec cookiespec = new RFC2965Spec();
        CookieOrigin origin = new CookieOrigin("www.domain.com", 80, "/", false);
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.