Examples of CookieAttributeHandler


Examples of org.apache.http.cookie.CookieAttributeHandler

    }

    public void testBasicPathMatch6() throws Exception {
        BasicClientCookie cookie = new BasicClientCookie("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

Examples of org.apache.http.cookie.CookieAttributeHandler

    }

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

Examples of org.apache.http.cookie.CookieAttributeHandler

    }

    public void testBasicPathValidate() throws Exception {
        BasicClientCookie cookie = new BasicClientCookie("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

Examples of org.apache.http.cookie.CookieAttributeHandler

            // expected
        }
    }

    public void testBasicPathInvalidInput() throws Exception {
        CookieAttributeHandler h = new BasicPathHandler();
        try {
            h.parse(null, null);
            fail("IllegalArgumentException must have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
        try {
            h.match(null, null);
            fail("IllegalArgumentException must have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
        try {
            h.match(new BasicClientCookie("name", "value"), null);
            fail("IllegalArgumentException must have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
    }
View Full Code Here

Examples of org.apache.http.cookie.CookieAttributeHandler

        }
    }

    public void testBasicMaxAgeParse() throws Exception {
        BasicClientCookie cookie = new BasicClientCookie("name", "value");
        CookieAttributeHandler h = new BasicMaxAgeHandler();
        h.parse(cookie, "2000");
        assertNotNull(cookie.getExpiryDate());
    }
View Full Code Here

Examples of org.apache.http.cookie.CookieAttributeHandler

        assertNotNull(cookie.getExpiryDate());
    }

    public void testBasicMaxAgeParseInvalid() throws Exception {
        BasicClientCookie cookie = new BasicClientCookie("name", "value");
        CookieAttributeHandler h = new BasicMaxAgeHandler();
        try {
            h.parse(cookie, "garbage");
            fail("MalformedCookieException must have been thrown");
        } catch (MalformedCookieException ex) {
            // expected
        }
        try {
            h.parse(cookie, null);
            fail("MalformedCookieException must have been thrown");
        } catch (MalformedCookieException ex) {
            // expected
        }
    }
View Full Code Here

Examples of org.apache.http.cookie.CookieAttributeHandler

            // expected
        }
    }

    public void testBasicMaxAgeInvalidInput() throws Exception {
        CookieAttributeHandler h = new BasicMaxAgeHandler();
        try {
            h.parse(null, null);
            fail("IllegalArgumentException must have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
    }
View Full Code Here

Examples of org.apache.http.cookie.CookieAttributeHandler

        }
    }

    public void testBasicCommentParse() throws Exception {
        BasicClientCookie cookie = new BasicClientCookie("name", "value");
        CookieAttributeHandler h = new BasicCommentHandler();
        h.parse(cookie, "whatever");
        assertEquals("whatever", cookie.getComment());
        h.parse(cookie, null);
        assertEquals(null, cookie.getComment());
    }
View Full Code Here

Examples of org.apache.http.cookie.CookieAttributeHandler

        h.parse(cookie, null);
        assertEquals(null, cookie.getComment());
    }

    public void testBasicCommentInvalidInput() throws Exception {
        CookieAttributeHandler h = new BasicCommentHandler();
        try {
            h.parse(null, null);
            fail("IllegalArgumentException must have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected
        }
    }
View Full Code Here

Examples of org.apache.http.cookie.CookieAttributeHandler

        }
    }
   
    public void testBasicSecureParse() throws Exception {
        BasicClientCookie cookie = new BasicClientCookie("name", "value");
        CookieAttributeHandler h = new BasicSecureHandler();
        h.parse(cookie, "whatever");
        assertTrue(cookie.isSecure());
        h.parse(cookie, null);
        assertTrue(cookie.isSecure());
    }
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.