Package org.eclipse.jetty.client.api

Examples of org.eclipse.jetty.client.api.Request.header()


                // Mangle the cookie, replacing Path with $Path, etc.
                sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
               
                //do another request to change the session attribute
                Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=setA");
                request.header("Cookie", sessionCookie);
                response = request.send();

                assertEquals(HttpServletResponse.SC_OK,response.getStatus());
                A_VALUE.assertPassivatesEquals(1);
                A_VALUE.assertActivatesEquals(1);
View Full Code Here


                A_VALUE.assertBindsEquals(1);
                A_VALUE.assertUnbindsEquals(0);
               
                //do another request using the cookie to try changing the session attribute to the same value again             
                request= client.newRequest("http://localhost:" + port + "/mod/test?action=setA");
                request.header("Cookie", sessionCookie);
                response = request.send();
                assertEquals(HttpServletResponse.SC_OK,response.getStatus());
                A_VALUE.assertPassivatesEquals(2);
                A_VALUE.assertActivatesEquals(2);
                A_VALUE.assertBindsEquals(1);
View Full Code Here

                A_VALUE.assertBindsEquals(1);
                A_VALUE.assertUnbindsEquals(0);
               
                //do another request using the cookie and change to a different value            
                request= client.newRequest("http://localhost:" + port + "/mod/test?action=setB");
                request.header("Cookie", sessionCookie);
                response = request.send();
                assertEquals(HttpServletResponse.SC_OK,response.getStatus());
                B_VALUE.assertPassivatesEquals(1);
                B_VALUE.assertActivatesEquals(1);
                B_VALUE.assertBindsEquals(1);
View Full Code Here

                Thread.currentThread().sleep(3*purgeDelay); //sleep long enough for purger to have run

                //make a request using previous session to test if its still there              
                Request request = client.newRequest("http://localhost:" + port + contextPath + servletMapping + "?action=test");
                request.header("Cookie", sessionCookie);
                ContentResponse response2 = request.send();
                assertEquals(HttpServletResponse.SC_OK,response2.getStatus());
            }
            finally
            {
View Full Code Here

                sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=","$1\\$Path=");

                //Make a request to the 2nd server which will do a refresh, use TestServlet to ensure that the
                //session attribute with dotted name is not removed
                Request request2 = client.newRequest("http://localhost:" + port2 + contextPath + servletMapping + "?action=get");
                request2.header("Cookie", sessionCookie);
                ContentResponse response2 = request2.send();
                assertEquals(HttpServletResponse.SC_OK,response2.getStatus());
               
            }
            finally
View Full Code Here

                // Mangle the cookie, replacing Path with $Path, etc.
                sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");

                //make a request to invalidate the session
                Request request = client.newRequest("http://localhost:" + port + contextPath + servletMapping + "?action=invalidate");
                request.header("Cookie", sessionCookie);
                response = request.send();
                assertEquals(HttpServletResponse.SC_OK,response.getStatus());
               
                Thread.currentThread().sleep(3*purgeDelay); //sleep long enough for purger to have run
               
View Full Code Here

               
                Thread.currentThread().sleep(3*purgeDelay); //sleep long enough for purger to have run
               
                //make a request using previous session to test if its still there
                request = client.newRequest("http://localhost:" + port + contextPath + servletMapping + "?action=test");
                request.header("Cookie", sessionCookie);
                response = request.send();
                assertEquals(HttpServletResponse.SC_OK,response.getStatus());
            }
            finally
            {
View Full Code Here

                // Mangle the cookie, replacing Path with $Path, etc.
                sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
               
                //do another request to change the maxinactive interval
                Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=change&val="+newMaxInactive);
                request.header("Cookie", sessionCookie);
                response = request.send();

                assertEquals(HttpServletResponse.SC_OK,response.getStatus());
                              
                //wait for longer than the old inactive interval
View Full Code Here

                Thread.currentThread().sleep(10*1000L);
               
                //do another request using the cookie to ensure the session is still there
              
                request= client.newRequest("http://localhost:" + port + "/mod/test?action=test");
                request.header("Cookie", sessionCookie);
                response = request.send();
                assertEquals(HttpServletResponse.SC_OK,response.getStatus());
            }
            finally
            {
View Full Code Here

                long lastSaved = ((JDBCSessionManager.Session)servlet._session).getLastSaved();
               
               
                //do another request to change the session attribute
                Request request = client.newRequest("http://localhost:" + port + "/mod/test?action=set");
                request.header("Cookie", sessionCookie);
                response = request.send();
                assertEquals(HttpServletResponse.SC_OK,response.getStatus());
                long tmp = ((JDBCSessionManager.Session)servlet._session).getLastSaved();
                assertNotEquals(lastSaved, tmp); //set of attribute will cause save to db
                lastSaved = tmp;
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.