Package org.eclipse.jetty.client

Examples of org.eclipse.jetty.client.HttpClient.newRequest()


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

                    // Be sure the session is also present in node2
                    org.eclipse.jetty.client.api.Request request = client.newRequest(urls[1] + "?action=test");
                    request.header("Cookie", sessionCookie);
                    ContentResponse response2 = request.send();
                    assertEquals(HttpServletResponse.SC_OK,response2.getStatus());

View Full Code Here


                    // Wait for the scavenger to run on node1, waiting 2.5 times the scavenger period
                    pause(scavengePeriod);

                    // Check that node1 does not have any local session cached
                    request = client.newRequest(urls[0] + "?action=check");
                    request.header("Cookie", sessionCookie);
                    response1 = request.send();
                    assertEquals(HttpServletResponse.SC_OK,response1.getStatus());

View Full Code Here

                    // Wait for the scavenger to run on node2, waiting 2 times the scavenger period
                    // This ensures that the scavenger on node2 runs at least once.
                    pause(scavengePeriod);

                    // Check that node2 does not have any local session cached
                    request = client.newRequest(urls[1] + "?action=check");
                    request.header("Cookie", sessionCookie);
                    response2 = request.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=");

                    // Perform a request to server2 using the session cookie from the previous request
                    // This should migrate the session from server1 to server2.
                    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());
                    String response = response2.getContentAsString();
                    assertEquals(response.trim(),String.valueOf(value));               }
View Full Code Here

                    int requestInterval = 500;


                    for (int i = 0; i < 10; ++i)
                    {
                        Request request2 = client.newRequest("http://localhost:" + port1 + contextPath + servletMapping);
                        request2.header("Cookie", sessionCookie);
                        ContentResponse response2 = request2.send();

                        assertEquals(HttpServletResponse.SC_OK , response2.getStatus());
                        assertTrue(sessionTestValue < Long.parseLong(response2.getContentAsString()));
View Full Code Here

               
                //restart the context
                context.start();
              
                // Make another request using the session id from before
                Request 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

                    // We want to test that optimizations done to the saving of the shared lastAccessTime
                    // do not break the correct working
                    int requestInterval = 500;
                    for (int i = 0; i < maxInactivePeriod * (1000 / requestInterval); ++i)
                    {
                        Request request = client.newRequest("http://localhost:" + port2 + contextPath + servletMapping);
                        request.header("Cookie", sessionCookie);
                        ContentResponse response2 = request.send();
                        assertEquals(HttpServletResponse.SC_OK , response2.getStatus());
                        assertEquals("test", response2.getContentAsString());

View Full Code Here

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

                    // Be sure the session is also present in node2

                    Request request2 = client.newRequest(urls[1] + "?action=increment");
                    request2.header("Cookie", sessionCookie);
                    ContentResponse response2 = request2.send();
                    assertEquals(HttpServletResponse.SC_OK,response2.getStatus());

                    // Invalidate on node1
View Full Code Here

                    request2.header("Cookie", sessionCookie);
                    ContentResponse response2 = request2.send();
                    assertEquals(HttpServletResponse.SC_OK,response2.getStatus());

                    // Invalidate on node1
                    Request request1 = client.newRequest(urls[0] + "?action=invalidate");
                    request1.header("Cookie", sessionCookie);
                    response1 = request1.send();
                    assertEquals(HttpServletResponse.SC_OK, response1.getStatus());

                    pause();
View Full Code Here

                    assertEquals(HttpServletResponse.SC_OK, response1.getStatus());

                    pause();

                    // Be sure on node2 we don't see the session anymore
                    request2 = client.newRequest(urls[1] + "?action=test");
                    request2.header("Cookie", sessionCookie);
                    response2 = request2.send();
                    assertEquals(HttpServletResponse.SC_OK,response2.getStatus());
                }
                finally
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.