Code example for HttpCookie

Methods: setDomain

0
    /** 
     * From the spec, "If an explicitly specified value does not start with a dot, the user agent 
     * supplies a leading dot.". This prepending doesn't happen in setDomain. 
     */ 
    public void testDomainNotAutomaticallyPrefixedWithDot() { 
        HttpCookie cookie = new HttpCookie("Foo", "foo");
        cookie.setDomain("localhost");
        assertEquals("localhost", cookie.getDomain());
    } 
 
    public void testCookieStoreNullUris() { 
        CookieStore cookieStore = new CookieManager().getCookieStore();
        HttpCookie cookieA = new HttpCookie("a", "android");
        cookieA.setDomain(".android.com");
        cookieA.setPath("/source");
        HttpCookie cookieB = new HttpCookie("b", "banana");
        cookieA.setDomain("code.google.com");
        cookieA.setPath("/p/android");
 
        try { 
Connect your IDE to all the code out there  Get Codota for Java