Package org.eclipse.jetty.http

Examples of org.eclipse.jetty.http.HttpFields.clear()


        assertFalse(e.hasMoreElements());
        assertEquals("Thu, 01 Jan 1970 00:00:00 GMT",fields.get("Expires"));
        assertFalse(e.hasMoreElements());
       
        //test cookies with same name, different domain
        fields.clear();
        response.addSetCookie("everything","other","domain1","path",0,"blah",true,true,0);
        response.addSetCookie("everything","value","domain2","path",0,"comment",true,true,0);
        e =fields.getValues("Set-Cookie");
        assertTrue(e.hasMoreElements());
        assertEquals("everything=other;Version=1;Path=path;Domain=domain1;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Max-Age=0;Secure;HttpOnly;Comment=blah",e.nextElement());
View Full Code Here


        assertTrue(e.hasMoreElements());
        assertEquals("everything=value;Version=1;Path=path;Domain=domain2;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Max-Age=0;Secure;HttpOnly;Comment=comment",e.nextElement());
        assertFalse(e.hasMoreElements());
       
        //test cookies with same name, same path, one with domain, one without
        fields.clear();
        response.addSetCookie("everything","other","domain1","path",0,"blah",true,true,0);
        response.addSetCookie("everything","value","","path",0,"comment",true,true,0);
        e =fields.getValues("Set-Cookie");
        assertTrue(e.hasMoreElements());
        assertEquals("everything=other;Version=1;Path=path;Domain=domain1;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Max-Age=0;Secure;HttpOnly;Comment=blah",e.nextElement());
View Full Code Here

        assertEquals("everything=value;Version=1;Path=path;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Max-Age=0;Secure;HttpOnly;Comment=comment",e.nextElement());
        assertFalse(e.hasMoreElements());
       
       
        //test cookies with same name, different path
        fields.clear();
        response.addSetCookie("everything","other","domain1","path1",0,"blah",true,true,0);
        response.addSetCookie("everything","value","domain1","path2",0,"comment",true,true,0);
        e =fields.getValues("Set-Cookie");
        assertTrue(e.hasMoreElements());
        assertEquals("everything=other;Version=1;Path=path1;Domain=domain1;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Max-Age=0;Secure;HttpOnly;Comment=blah",e.nextElement());
View Full Code Here

        assertTrue(e.hasMoreElements());
        assertEquals("everything=value;Version=1;Path=path2;Domain=domain1;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Max-Age=0;Secure;HttpOnly;Comment=comment",e.nextElement());
        assertFalse(e.hasMoreElements());
       
        //test cookies with same name, same domain, one with path, one without
        fields.clear();
        response.addSetCookie("everything","other","domain1","path1",0,"blah",true,true,0);
        response.addSetCookie("everything","value","domain1","",0,"comment",true,true,0);
        e =fields.getValues("Set-Cookie");
        assertTrue(e.hasMoreElements());
        assertEquals("everything=other;Version=1;Path=path1;Domain=domain1;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Max-Age=0;Secure;HttpOnly;Comment=blah",e.nextElement());
View Full Code Here

        assertTrue(e.hasMoreElements());
        assertEquals("everything=value;Version=1;Domain=domain1;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Max-Age=0;Secure;HttpOnly;Comment=comment",e.nextElement());
        assertFalse(e.hasMoreElements());
       
        //test cookies same name only, no path, no domain
        fields.clear();
        response.addSetCookie("everything","other","","",0,"blah",true,true,0);
        response.addSetCookie("everything","value","","",0,"comment",true,true,0);
        e =fields.getValues("Set-Cookie");
        assertTrue(e.hasMoreElements());
        assertEquals("everything=value;Version=1;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Max-Age=0;Secure;HttpOnly;Comment=comment",e.nextElement());
View Full Code Here

        e =fields.getValues("Set-Cookie");
        assertTrue(e.hasMoreElements());
        assertEquals("everything=value;Version=1;Expires=Thu, 01-Jan-1970 00:00:00 GMT;Max-Age=0;Secure;HttpOnly;Comment=comment",e.nextElement());
        assertFalse(e.hasMoreElements());

        fields.clear();
        response.addSetCookie("ev erything","va lue","do main","pa th",1,"co mment",true,true,1);
        String setCookie=fields.get("Set-Cookie");
        assertThat(setCookie,Matchers.startsWith("\"ev erything\"=\"va lue\";Version=1;Path=\"pa th\";Domain=\"do main\";Expires="));
        assertThat(setCookie,Matchers.endsWith(" GMT;Max-Age=1;Secure;HttpOnly;Comment=\"co mment\""));
View Full Code Here

        response.addSetCookie("ev erything","va lue","do main","pa th",1,"co mment",true,true,1);
        String setCookie=fields.get("Set-Cookie");
        assertThat(setCookie,Matchers.startsWith("\"ev erything\"=\"va lue\";Version=1;Path=\"pa th\";Domain=\"do main\";Expires="));
        assertThat(setCookie,Matchers.endsWith(" GMT;Max-Age=1;Secure;HttpOnly;Comment=\"co mment\""));

        fields.clear();
        response.addSetCookie("name","value",null,null,-1,null,false,false,0);
        setCookie=fields.get("Set-Cookie");
        assertEquals(-1,setCookie.indexOf("Version="));
        fields.clear();
        response.addSetCookie("name","v a l u e",null,null,-1,null,false,false,0);
View Full Code Here

        fields.clear();
        response.addSetCookie("name","value",null,null,-1,null,false,false,0);
        setCookie=fields.get("Set-Cookie");
        assertEquals(-1,setCookie.indexOf("Version="));
        fields.clear();
        response.addSetCookie("name","v a l u e",null,null,-1,null,false,false,0);
        setCookie=fields.get("Set-Cookie");

        fields.clear();
        response.addSetCookie("json","{\"services\":[\"cwa\", \"aa\"]}",null,null,-1,null,false,false,-1);
View Full Code Here

        assertEquals(-1,setCookie.indexOf("Version="));
        fields.clear();
        response.addSetCookie("name","v a l u e",null,null,-1,null,false,false,0);
        setCookie=fields.get("Set-Cookie");

        fields.clear();
        response.addSetCookie("json","{\"services\":[\"cwa\", \"aa\"]}",null,null,-1,null,false,false,-1);
        assertEquals("json=\"{\\\"services\\\":[\\\"cwa\\\", \\\"aa\\\"]}\"",fields.get("Set-Cookie"));

        fields.clear();
        response.addSetCookie("name","value","domain",null,-1,null,false,false,-1);
View Full Code Here

        fields.clear();
        response.addSetCookie("json","{\"services\":[\"cwa\", \"aa\"]}",null,null,-1,null,false,false,-1);
        assertEquals("json=\"{\\\"services\\\":[\\\"cwa\\\", \\\"aa\\\"]}\"",fields.get("Set-Cookie"));

        fields.clear();
        response.addSetCookie("name","value","domain",null,-1,null,false,false,-1);
        response.addSetCookie("name","other","domain",null,-1,null,false,false,-1);
        assertEquals("name=other;Domain=domain",fields.get("Set-Cookie"));
        response.addSetCookie("name","more","domain",null,-1,null,false,false,-1);
        assertEquals("name=more;Domain=domain",fields.get("Set-Cookie"));
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.