Package org.deftserver.web.http.client

Examples of org.deftserver.web.http.client.AsynchronousHttpClient.fetch()


     
      public void onFailure(Throwable e) { }
   
    };
    // make sure that the http.fetch(..) is invoked from the ioloop thread
    IOLoop.INSTANCE.addCallback(new AsyncCallback() { public void onCallback() { http.fetch(url, cb); }});
    latch.await(5, TimeUnit.SECONDS);
    assertEquals(0, latch.getCount());   
  }
 
  private String convertStreamToString(InputStream is) throws IOException {
View Full Code Here


public class AsynchronousHttpClientExample {

  public static void main(String[] args) {
    AsynchronousHttpClient client = new AsynchronousHttpClient();
    client.fetch("http://sunet.se/",
        new AsyncResult<Response>() {
          public void onFailure(Throwable caught) { out.println("exception:\n" + caught);}
          public void onSuccess(Response response) { out.println("http resonse:\n" + response);}
        }
    );
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.