Package javax.ws.rs.core

Examples of javax.ws.rs.core.NewCookie


    }
   
       
    @Test
    public void testFromComplexString() {
        NewCookie c =
            NewCookie.parse("foo=bar;Comment=comment;Path=path;Max-Age=10;Domain=domain;Secure;Version=1");
        assertTrue("bar".equals(c.getValue())
                   && "foo".equals(c.getName())
                   && 1 == c.getVersion()
                   && "path".equals(c.getPath())
                   && "domain".equals(c.getDomain())
                   && "comment".equals(c.getComment())
                   && 10 == c.getMaxAge());
    }
View Full Code Here


                   && 10 == c.getMaxAge());
    }
   
    @Test
    public void testToString() {
        NewCookie c = new NewCookie("foo", "bar", "path", "domain", "comment", 2, true);
        assertEquals("foo=bar;Comment=comment;Domain=domain;Max-Age=2;Path=path;Secure;Version=1",
                     c.toString());
              
    }
View Full Code Here

       
        if (name == null || value == null) {
            throw new IllegalArgumentException("Set-Cookie is malformed : " + c);
        }
       
        return new NewCookie(name, value, path, domain, comment, maxAge, isSecure);
    }
View Full Code Here

        NewCookie.valueOf(null);
    }
       
    @Test
    public void testFromSimpleString() {
        NewCookie c = NewCookie.valueOf("foo=bar");
        assertTrue("bar".equals(c.getValue())
                   && "foo".equals(c.getName()));
    }
View Full Code Here

                   && "foo".equals(c.getName()));
    }
   
    @Test
    public void testFromSimpleStringWithExpires() {
        NewCookie c = NewCookie.valueOf("foo=bar;Expires=Wed, 09 Jun 2021 10:18:14 GMT");
        assertTrue("bar".equals(c.getValue())
                   && "foo".equals(c.getName()));
    }
View Full Code Here

    }
   
       
    @Test
    public void testFromComplexString() {
        NewCookie c = NewCookie.valueOf(
                      "foo=bar;Comment=comment;Path=path;Max-Age=10;Domain=domain;Secure;Version=1");
        assertTrue("bar".equals(c.getValue())
                   && "foo".equals(c.getName())
                   && 1 == c.getVersion()
                   && "path".equals(c.getPath())
                   && "domain".equals(c.getDomain())
                   && "comment".equals(c.getComment())
                   && 10 == c.getMaxAge());
    }
View Full Code Here

    }
   
   
    @Test
    public void testFromStringWithSpaces() {
        NewCookie c = NewCookie.valueOf(
                      "foo=bar; Comment=comment; Path=path; Max-Age=10; Domain=domain; Secure; Version=1");
        assertTrue("bar".equals(c.getValue())
                   && "foo".equals(c.getName())
                   && 1 == c.getVersion()
                   && "path".equals(c.getPath())
                   && "domain".equals(c.getDomain())
                   && "comment".equals(c.getComment())
                   && 10 == c.getMaxAge());
    }
View Full Code Here

                   && 10 == c.getMaxAge());
    }
   
    @Test
    public void testToString() {
        NewCookie c = new NewCookie("foo", "bar", "path", "domain", "comment", 2, true);
        assertEquals("foo=bar;Comment=comment;Domain=domain;Max-Age=2;Path=path;Secure;Version=1",
                     c.toString());
              
    }
View Full Code Here

    @Test
    public void testAddCookie() {
        MetadataMap<String, Object> m = new MetadataMap<String, Object>();
        m.add("Set-Cookie", "a=b;Version=1");
        m.add("Set-Cookie", "c=d;Version=1");
        checkBuild(Response.ok().cookie(new NewCookie("a", "b"))
                                .cookie(new NewCookie("c", "d")).build(),
                  200, null, m);
    }
View Full Code Here

       
        if (name == null || value == null) {
            throw new IllegalArgumentException("Set-Cookie is malformed : " + c);
        }
       
        return new NewCookie(name, value, path, domain, comment, maxAge, isSecure);
    }
View Full Code Here

TOP

Related Classes of javax.ws.rs.core.NewCookie

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.