Examples of preparePost()


Examples of com.ning.http.client.AsyncHttpClient.preparePost()

                }
            });

            // Let Atmosphere suspend the connections.
            Thread.sleep(2500);
            c.preparePost(urlTarget + "/delay").addParameter("message", "foo").execute().get();
            c.preparePost(urlTarget + "/publishAndResume").addParameter("message", "bar").execute().get();

            try {
                latch.await(20, TimeUnit.SECONDS);
            } catch (InterruptedException e) {
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.preparePost()

            });

            // Let Atmosphere suspend the connections.
            Thread.sleep(2500);
            c.preparePost(urlTarget + "/delay").addParameter("message", "foo").execute().get();
            c.preparePost(urlTarget + "/publishAndResume").addParameter("message", "bar").execute().get();

            try {
                latch.await(20, TimeUnit.SECONDS);
            } catch (InterruptedException e) {
                fail(e.getMessage());
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.preparePost()

                }
            });

            // Let Atmosphere suspend the connections.
            Thread.sleep(2500);
            c.preparePost(urlTarget + "/delay").addParameter("message", "foo").execute().get();
            c.preparePost(urlTarget + "/delayAndResume").addParameter("message", "bar").execute().get();

            try {
                latch.await(20, TimeUnit.SECONDS);
            } catch (InterruptedException e) {
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.preparePost()

            });

            // Let Atmosphere suspend the connections.
            Thread.sleep(2500);
            c.preparePost(urlTarget + "/delay").addParameter("message", "foo").execute().get();
            c.preparePost(urlTarget + "/delayAndResume").addParameter("message", "bar").execute().get();

            try {
                latch.await(20, TimeUnit.SECONDS);
            } catch (InterruptedException e) {
                fail(e.getMessage());
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.preparePost()

                    .setUsePreemptiveAuth(true)
                    .setScheme(Realm.AuthScheme.BASIC)
                    .build();
            // currently, not really async...
            Response response =
                    asyncHttpClient.preparePost(url)
                            .addHeader("Accept", "application/json")
                            .addHeader("Content-type", "application/json")
                            .setRealm(realm)
                            .setBody(jsonPayloadObject)
                            .execute().get();
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.preparePost()

             
              if (null == postContent) {
                asyncRequest = asyncHttpClient.prepareGet(request.endPointUrl.replace("$1", entityValue));
              }
              else {
                asyncRequest = asyncHttpClient.preparePost(request.endPointUrl.replace("$1", entityValue));             
              }//TESTED (by hand, "http://httpbin.org/post", "httpFields": { "Content": "test" }
             
              if (null != request.urlParams) {
                for (Map.Entry<String, String> keyValue: request.urlParams.entrySet()) {
                  asyncRequest = asyncRequest.addQueryParameter(keyValue.getKey(), keyValue.getValue().replace("$1", entityValue));
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.preparePost()

  @Test
  public void smallHttpPostBodyTest() throws ClientProtocolException, IOException, InterruptedException {
    final String body = "Roger Schildmeijer";
    final CountDownLatch latch = new CountDownLatch(1);
    AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
    asyncHttpClient.preparePost("http://localhost:" + PORT + "/echo").setBody(body).
    execute(new AsyncCompletionHandler<Response>(){

      @Override
      public Response onCompleted(Response response) throws Exception{
        assertNotNull(response);
View Full Code Here

Examples of com.ning.http.client.AsyncHttpClient.preparePost()

      body += "Roger Schildmeijer: " + i + "\n";
    }
    final String expectedBody = body;
    final CountDownLatch latch = new CountDownLatch(1);
    AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
    asyncHttpClient.preparePost("http://localhost:" + PORT + "/echo").setBody(body).
    execute(new AsyncCompletionHandler<Response>(){

      @Override
      public Response onCompleted(Response response) throws Exception{
        assertNotNull(response);
View Full Code Here

Examples of org.asynchttpclient.AsyncHttpClient.preparePost()

        AsyncHttpClient client = getAsyncHttpClient(null);
        try {
            final AtomicBoolean headerSent = new AtomicBoolean(false);
            final AtomicBoolean operationCompleted = new AtomicBoolean(false);

            Response resp = client.preparePost("http://127.0.0.1:" + port1 + "/").setBody(SIMPLE_TEXT_FILE).execute(new AsyncCompletionHandler<Response>() {

                public STATE onHeaderWriteCompleted() {
                    headerSent.set(true);
                    return STATE.CONTINUE;
                }
View Full Code Here

Examples of org.asynchttpclient.AsyncHttpClient.preparePost()

        AsyncHttpClient client = getAsyncHttpClient(null);
        File tmp = new File(System.getProperty("java.io.tmpdir") + File.separator + "zeroCopy.txt");
        tmp.deleteOnExit();
        final FileOutputStream stream = new FileOutputStream(tmp);
        try {
            Response resp = client.preparePost("http://127.0.0.1:" + port1 + "/").setBody(SIMPLE_TEXT_FILE).execute(new AsyncHandler<Response>() {
                public void onThrowable(Throwable t) {
                }

                public STATE onBodyPartReceived(HttpResponseBodyPart bodyPart) throws Exception {
                    bodyPart.writeTo(stream);
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.