Package org.eclipse.jetty.client.api

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


                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
                Thread.currentThread().sleep(10*1000L);
 
View Full Code Here


               
                //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
            {
                client.stop();
View Full Code Here

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

                //do another request to access the session, this will cause session to be initially
                //checked against db. On exit of request, the access time will need updating, so the
                //session will be saved to db.
                request = client.newRequest("http://localhost:" + port + "/mod/test?action=tickle");
                request.header("Cookie", sessionCookie);
                response = request.send();
                assertEquals(HttpServletResponse.SC_OK,response.getStatus());
                tmp = ((JDBCSessionManager.Session)servlet._session).getLastSaved();
                assertNotEquals(lastSaved, tmp);
                lastSaved = tmp;
             
View Full Code Here

                //do another request to access the session. This time, the save interval has not
                //expired, so we should NOT see a debug trace of loading stale session. Nor should
                //the exit of the request cause a save of the updated access time.
                request = client.newRequest("http://localhost:" + port + "/mod/test?action=tickle");
                request.header("Cookie", sessionCookie);
                response = request.send();
                assertEquals(HttpServletResponse.SC_OK,response.getStatus());
                tmp = ((JDBCSessionManager.Session)servlet._session).getLastSaved();
                assertEquals(lastSaved, tmp); //the save interval did not expire, so update to the access time will not have been persisted
            }
            finally
View Full Code Here

        //Log.getLog().setDebugEnabled(true);
        Request request = client.newRequest("http://localhost:" + port + "" + "/test");
        if (sessionCookie != null)
            request.header("Cookie", sessionCookie);
        ContentResponse response = request.send();
        assertEquals(HttpServletResponse.SC_OK, response.getStatus());

        sessionCookie = response.getHeaders().get("Set-Cookie");
        assertTrue( sessionCookie != null );
        // Mangle the cookie, replacing Path with $Path, etc.
View Full Code Here

                //restart webapp
                webApp.start();
               
                Request request = client.newRequest("http://localhost:" + port1 + contextPath + "/bar?action=get");
                request.header("Cookie", sessionCookie);
                response = request.send();
                assertEquals(HttpServletResponse.SC_OK,response.getStatus());
                String afterStopSessionId = (String)webApp.getServletContext().getAttribute("foo.session");
               
                assertNotNull(afterStopSessionId);
                assertTrue(!afterStopSessionId.equals(sessionId))
View Full Code Here

            String content = new String(response.getContent());
            assertTrue(content.contains("<h1>Servlet 3.1 Test WebApp</h1>"));
           
            Request req = client.POST("http://127.0.0.1:" + TestJettyOSGiBootCore.DEFAULT_HTTP_PORT + "/test");
            response = req.send();
            content = new String(response.getContent());
            assertTrue(content.contains("<p><b>Result: <span class=\"pass\">PASS</span></p>"));
        }
        finally
        {
View Full Code Here

        if (entity != null) {
            jettyRequest.content(entity);
        }

        try {
            final ContentResponse jettyResponse = jettyRequest.send();
            HeaderUtils.checkHeaderChanges(clientHeadersSnapshot, jerseyRequest.getHeaders(),
                    JettyConnector.this.getClass().getName());

            final javax.ws.rs.core.Response.StatusType status = jettyResponse.getReason() == null ?
                    Statuses.from(jettyResponse.getStatus()) :
View Full Code Here

                    }
                }
            });
            final AtomicReference<ClientResponse> jerseyResponse = new AtomicReference<ClientResponse>();
            final ByteBufferInputStream entityStream = new ByteBufferInputStream();
            jettyRequest.send(new Response.Listener.Adapter() {

                @Override
                public void onHeaders(final Response jettyResponse) {
                    HeaderUtils.checkHeaderChanges(clientHeadersSnapshot, jerseyRequest.getHeaders(),
                            JettyConnector.this.getClass().getName());
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.