Examples of NewRequest()


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

                    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

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

               
                //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

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

                    // 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

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

                    // 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

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

                    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

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

                    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

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

                sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
                //ensure sessionCreated listener is called
                assertTrue (testListener.isCreated());

                //now delete the session
                Request request = client.newRequest("http://localhost:" + port + contextPath + servletMapping + "?action=delete");
                request.header("Cookie", sessionCookie);
                response = request.send();
                assertEquals(HttpServletResponse.SC_OK,response.getStatus());
                //ensure sessionDestroyed listener is called
                assertTrue(testListener.isDestroyed());
View Full Code Here

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

                assertTrue(testListener.isDestroyed());


                // The session is not there anymore, but we present an old cookie
                // The server creates a new session, we must ensure we released all locks
                request = client.newRequest("http://localhost:" + port + contextPath + servletMapping + "?action=check");
                request.header("Cookie", sessionCookie);
                response = request.send();
                assertEquals(HttpServletResponse.SC_OK,response.getStatus());
            }
            finally
View Full Code Here

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

                HttpClient client = new HttpClient();
                client.start();
                try
                {
                    // Perform one request to server1 to create a session
                    Request request = client.newRequest("http://localhost:" + port1 + contextPath + servletMapping + "?action=set");
                    request.method(HttpMethod.GET);

                    ContentResponse response = request.send();
                    assertEquals( HttpServletResponse.SC_OK, response.getStatus());
                    String sessionCookie = response.getHeaders().get("Set-Cookie");
View Full Code Here

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=");

                    // Perform a request to server2 using the session cookie from the previous request
                    Request request2 = client.newRequest("http://localhost:" + port2 + contextPath + servletMapping + "?action=get");
                    request2.method(HttpMethod.GET);
                    request2.header("Cookie", sessionCookie);
                    ContentResponse response2 = request2.send();

                    assertEquals(HttpServletResponse.SC_OK,response2.getStatus());
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.