Package org.eclipse.jetty.client.api

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


    if (body != null) {
      httpRequest.content(new StringContentProvider(body));
    }
    ContentResponse response;
    try {
      response = httpRequest.send();
    }
    catch (Exception ex) {
      throw new SockJsTransportFailureException("Failed to execute request to " + url, null, ex);
    }
    HttpStatus status = HttpStatus.valueOf(response.getStatus());
View Full Code Here


    if (logger.isTraceEnabled()) {
      logger.trace("Starting XHR receive request, url=" + url);
    }
    Request httpRequest = this.httpClient.newRequest(url).method(HttpMethod.POST);
    addHttpHeaders(httpRequest, headers);
    httpRequest.send(listener);
  }


  /**
   * Splits the body of an HTTP response into SockJS frames and delegates those
View Full Code Here

        Request httpRequest = prepareRequest(request);


        try {
            ContentResponse contentResponse = httpRequest.send();
            return new JettyHttpResponse(contentResponse, httpRequest.getURI());
        } catch (InterruptedException e) {
            throw new ClientException(e.toString(), e);
        } catch (TimeoutException e) {
            throw new RequestTimeoutException(e.toString(), e);
View Full Code Here

            @Override
            public void onFailure(Request jettyRequest, Throwable failure) {
                FlowContextFactory.addFlowContext(((S) tempRequest).getFlowContext());
            }
        });
        httpRequest.send(new JettyCompleteListener(this, request, responseCallback, serverProxy, loadBalancerStrategy, apiName));

    }


    private Request prepareRequest(HttpRequest request) {
View Full Code Here

        }
        // Set the idle timeout for this request larger than the total timeout
        // so there are no races between the two timeouts
        request.idleTimeout(maxNetworkDelay * 2, TimeUnit.MILLISECONDS);
        request.timeout(maxNetworkDelay, TimeUnit.MILLISECONDS);
        request.send(new BufferingResponseListener(_maxBufferSize)
        {
            @Override
            public boolean onHeader(Response response, HttpField field)
            {
                HttpHeader header = field.getHeader();
View Full Code Here

                "\"channel\": \"/meta/handshake\"," +
                "\"version\": \"1.0\"," +
                "\"minimumVersion\": \"1.0\"," +
                "\"supportedConnectionTypes\": [\"long-polling\"]" +
                "}]");
        ContentResponse response = handshake.send();
        Assert.assertEquals(200, response.getStatus());

        String clientId = extractClientId(response);

        Request connect = newBayeuxRequest("" +
View Full Code Here

                "\"channel\": \"/meta/connect\"," +
                "\"clientId\": \"" + clientId + "\"," +
                "\"connectionType\": \"long-polling\"," +
                "\"advice\": { \"timeout\": 0 }" +
                "}]");
        response = connect.send();
        Assert.assertEquals(200, response.getStatus());

        connect = newBayeuxRequest("" +
                "[{" +
                "\"channel\": \"/meta/connect\"," +
View Full Code Here

                "\"channel\": \"/meta/connect\"," +
                "\"clientId\": \"" + clientId + "\"," +
                "\"connectionType\": \"long-polling\"" +
                "}]");
        FutureResponseListener futureResponse = new FutureResponseListener(connect);
        connect.send(futureResponse);

        // Wait for the connect to arrive to the server
        Thread.sleep(1000);

        // Stop the context; this is the first half of a redeploy
View Full Code Here

                "\"channel\": \"/meta/handshake\"," +
                "\"version\": \"1.0\"," +
                "\"minimumVersion\": \"1.0\"," +
                "\"supportedConnectionTypes\": [\"long-polling\"]" +
                "}]");
        ContentResponse response = handshake.send();
        Assert.assertEquals(200, response.getStatus());

        String clientId = extractClientId(response);

        Request connect = newBayeuxRequest("[{" +
View Full Code Here

        Request connect = newBayeuxRequest("[{" +
                "\"channel\": \"/meta/connect\"," +
                "\"clientId\": \"" + clientId + "\"," +
                "\"connectionType\": \"long-polling\"" +
                "}]");
        response = connect.send();

        Assert.assertEquals(200, response.getStatus());

        // Forge a bad JSON message
        Request badConnect = newBayeuxRequest("[{" +
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.