Package org.apache.http.impl.cookie

Examples of org.apache.http.impl.cookie.PublicSuffixFilter


    }
   
    public void testPublicSuffixFilter() throws Exception {
        BasicClientCookie cookie = new BasicClientCookie("name", "value");
       
        PublicSuffixFilter h = new PublicSuffixFilter(new RFC2109DomainHandler());
        h.setPublicSuffixes(Arrays.asList(new String[] { "co.uk", "com" }));
       
        cookie.setDomain(".co.uk");
        assertFalse(h.match(cookie, new CookieOrigin("apache.co.uk", 80, "/stuff", false)));
       
        cookie.setDomain("co.uk");
        assertFalse(h.match(cookie, new CookieOrigin("apache.co.uk", 80, "/stuff", false)));
       
        cookie.setDomain(".com");
        assertFalse(h.match(cookie, new CookieOrigin("apache.com", 80, "/stuff", false)));
       
        cookie.setDomain("com");
        assertFalse(h.match(cookie, new CookieOrigin("apache.com", 80, "/stuff", false)));       
       
        cookie.setDomain("localhost");
        assertTrue(h.match(cookie, new CookieOrigin("localhost", 80, "/stuff", false)));       
    }
View Full Code Here


    }
   
    public void testPublicSuffixFilter() throws Exception {
        BasicClientCookie cookie = new BasicClientCookie("name", "value");
       
        PublicSuffixFilter h = new PublicSuffixFilter(new RFC2109DomainHandler());
        h.setPublicSuffixes(Arrays.asList(new String[] { "co.uk", "com" }));
       
        cookie.setDomain(".co.uk");
        assertFalse(h.match(cookie, new CookieOrigin("apache.co.uk", 80, "/stuff", false)));
       
        cookie.setDomain("co.uk");
        assertFalse(h.match(cookie, new CookieOrigin("apache.co.uk", 80, "/stuff", false)));
       
        cookie.setDomain(".com");
        assertFalse(h.match(cookie, new CookieOrigin("apache.com", 80, "/stuff", false)));
       
        cookie.setDomain("com");
        assertFalse(h.match(cookie, new CookieOrigin("apache.com", 80, "/stuff", false)));       
       
        cookie.setDomain("localhost");
        assertTrue(h.match(cookie, new CookieOrigin("localhost", 80, "/stuff", false)));       
    }
View Full Code Here

    }
   
    public void testPublicSuffixFilter() throws Exception {
        BasicClientCookie cookie = new BasicClientCookie("name", "value");
       
        PublicSuffixFilter h = new PublicSuffixFilter(new RFC2109DomainHandler());
        h.setPublicSuffixes(Arrays.asList(new String[] { "co.uk", "com" }));
       
        cookie.setDomain(".co.uk");
        assertFalse(h.match(cookie, new CookieOrigin("apache.co.uk", 80, "/stuff", false)));
       
        cookie.setDomain("co.uk");
        assertFalse(h.match(cookie, new CookieOrigin("apache.co.uk", 80, "/stuff", false)));
       
        cookie.setDomain(".com");
        assertFalse(h.match(cookie, new CookieOrigin("apache.com", 80, "/stuff", false)));
       
        cookie.setDomain("com");
        assertFalse(h.match(cookie, new CookieOrigin("apache.com", 80, "/stuff", false)));       
       
        cookie.setDomain("localhost");
        assertTrue(h.match(cookie, new CookieOrigin("localhost", 80, "/stuff", false)));       
    }
View Full Code Here

    @Test
    public void testPublicSuffixFilter() throws Exception {
        BasicClientCookie cookie = new BasicClientCookie("name", "value");

        PublicSuffixFilter h = new PublicSuffixFilter(new RFC2109DomainHandler());
        h.setPublicSuffixes(Arrays.asList(new String[] { "co.uk", "com" }));

        cookie.setDomain(".co.uk");
        Assert.assertFalse(h.match(cookie, new CookieOrigin("apache.co.uk", 80, "/stuff", false)));

        cookie.setDomain("co.uk");
        Assert.assertFalse(h.match(cookie, new CookieOrigin("apache.co.uk", 80, "/stuff", false)));

        cookie.setDomain(".com");
        Assert.assertFalse(h.match(cookie, new CookieOrigin("apache.com", 80, "/stuff", false)));

        cookie.setDomain("com");
        Assert.assertFalse(h.match(cookie, new CookieOrigin("apache.com", 80, "/stuff", false)));

        cookie.setDomain("localhost");
        Assert.assertTrue(h.match(cookie, new CookieOrigin("localhost", 80, "/stuff", false)));
    }
View Full Code Here

    }
   
    public void testPublicSuffixFilter() throws Exception {
        BasicClientCookie cookie = new BasicClientCookie("name", "value");
       
        PublicSuffixFilter h = new PublicSuffixFilter(new RFC2109DomainHandler());
        h.setPublicSuffixes(Arrays.asList(new String[] { "co.uk", "com" }));
       
        cookie.setDomain(".co.uk");
        assertFalse(h.match(cookie, new CookieOrigin("apache.co.uk", 80, "/stuff", false)));
       
        cookie.setDomain("co.uk");
        assertFalse(h.match(cookie, new CookieOrigin("apache.co.uk", 80, "/stuff", false)));
       
        cookie.setDomain(".com");
        assertFalse(h.match(cookie, new CookieOrigin("apache.com", 80, "/stuff", false)));
       
        cookie.setDomain("com");
        assertFalse(h.match(cookie, new CookieOrigin("apache.com", 80, "/stuff", false)));       
       
        cookie.setDomain("localhost");
        assertTrue(h.match(cookie, new CookieOrigin("localhost", 80, "/stuff", false)));       
    }
View Full Code Here

TOP

Related Classes of org.apache.http.impl.cookie.PublicSuffixFilter

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.