Package org.eclipse.jetty.client.api

Examples of org.eclipse.jetty.client.api.Result


    }

    public void forwardSuccessComplete(List<Response.ResponseListener> listeners, Request request, Response response)
    {
        forwardSuccess(listeners, response);
        notifyComplete(listeners, new Result(request, response));
    }
View Full Code Here


    }

    public void forwardFailureComplete(List<Response.ResponseListener> listeners, Request request, Throwable requestFailure, Response response, Throwable responseFailure)
    {
        forwardFailure(listeners, response, responseFailure);
        notifyComplete(listeners, new Result(request, requestFailure, response, responseFailure));
    }
View Full Code Here

        // Reset to be ready for another response.
        reset();

        // Mark atomically the response as terminated and succeeded,
        // with respect to concurrency between request and response.
        Result result = exchange.terminateResponse(null);

        // It is important to notify *after* we reset and terminate
        // because the notification may trigger another request/response.
        HttpResponse response = exchange.getResponse();
        if (LOG.isDebugEnabled())
View Full Code Here

        dispose();

        // Mark atomically the response as terminated and failed,
        // with respect to concurrency between request and response.
        Result result = exchange.terminateResponse(failure);

        HttpResponse response = exchange.getResponse();
        if (LOG.isDebugEnabled())
            LOG.debug("Response failure {} {}", response, failure);
        List<Response.ResponseListener> listeners = exchange.getConversation().getResponseListeners();
View Full Code Here

        return true;
    }

    private void terminateResponse(HttpExchange exchange, Throwable failure)
    {
        Result result = exchange.terminateResponse(failure);
        terminateResponse(exchange, result);
    }
View Full Code Here

        ContentResponse response1 = request1.send();

        Assert.assertEquals(303, response1.getStatus());
        Assert.assertTrue(redirector.isRedirect(response1));

        Result result = redirector.redirect(request1, response1);
        org.eclipse.jetty.client.api.Request request2 = result.getRequest();
        Response response2 = result.getResponse();

        Assert.assertEquals(302, response2.getStatus());
        Assert.assertTrue(redirector.isRedirect(response2));

        final CountDownLatch latch = new CountDownLatch(1);
        redirector.redirect(request2, response2, new Response.CompleteListener()
        {
            @Override
            public void onComplete(Result result)
            {
                Response response3 = result.getResponse();
                Assert.assertEquals(200, response3.getStatus());
                Assert.assertFalse(redirector.isRedirect(response3));
                latch.countDown();
            }
        });
View Full Code Here

            ++length;
        }

        Assert.assertEquals(data.length, length);

        Result result = listener.await(5, TimeUnit.SECONDS);
        Assert.assertNotNull(result);
        Assert.assertFalse(result.isFailed());
        Assert.assertSame(response, result.getResponse());
    }
View Full Code Here

            Assert.assertEquals(b & 0xFF, read);
        }

        Assert.assertEquals(-1, input.read());

        Result result = listener.await(5, TimeUnit.SECONDS);
        Assert.assertNotNull(result);
        Assert.assertFalse(result.isFailed());
        Assert.assertSame(response, result.getResponse());
    }
View Full Code Here

        {
        }

        Assert.assertEquals(data.length, length);

        Result result = listener.await(5, TimeUnit.SECONDS);
        Assert.assertNotNull(result);
        Assert.assertTrue(result.isFailed());
    }
View Full Code Here

            }
        };
        client.newRequest("localhost", connector.getLocalPort())
                .scheme(scheme)
                .send(listener);
        Result result = listener.await(5, TimeUnit.SECONDS);
        Assert.assertEquals(200, result.getResponse().getStatus());
        Assert.assertNull(failure.get());
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jetty.client.api.Result

Copyright © 2018 www.massapicom. 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.