SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
Wri$ng	
  Powerful	
  HTTP	
  Apps	
  Using	
  
      the	
  New	
  Asynchronous	
  HTTP	
  Client	
  
                        Library	
  

h@p://github.com/AsyncH@pClient/async-­‐h@p-­‐client	
  

Jeanfrancois	
  Arcand	
              Hubert	
  Iwaniuk	
  
h@p://twi@er.com/jfarcand	
           h@p://twi@er.com/neotyk	
  
Creator	
  of	
  	
                   Creator	
  of	
  
                                        the	
  Grizzly	
                      GlassFish	
  v3	
  
Creator	
  and	
  Co-­‐                 Framework	
  	
                       Grizzly	
  Micro	
  
   Leader	
  of	
  	
                                                            Kernel	
  
 Atmosphere	
  

                                           Jeanfrancois	
  

           9	
  years	
  @	
  Sun	
                              Creator	
  Async	
  
            Microsystem	
                                         H@p	
  Client	
  


                                            Major	
  
                                        contributor	
  to	
  
                                          GlassFish	
  
•  News	
  and	
  Update	
  
•  Why	
  	
  
•  The	
  Async	
  H@p	
  Client	
  API	
  
•  Conclusion	
  	
  
•  Q	
  &	
  A	
  
Since	
  released,	
  we’ve	
  got	
  an	
  
    impressive	
  amount	
  of	
  
contribu$ons	
  and	
  adop$ons.	
  
   Library	
  is	
  evolving	
  fast!	
  
JDK’s	
  
UrlConnec$on	
  
Totally	
  Broken	
  



                        Why	
  
JDK’s	
                          Apache	
  
UrlConnec$on	
                    H@pClient	
  high	
  
Totally	
  Broken	
                 on	
  steroid	
  



                        Why	
  
JDK’s	
                           Apache	
  
 UrlConnec$on	
                     H@pClient	
  high	
  
 Totally	
  Broken	
                  on	
  steroid	
  



                          Why	
  
Apache	
  H@p	
  is	
  
  blocking	
  
JDK’s	
                                              Apache	
  
 UrlConnec$on	
                                        H@pClient	
  high	
  
 Totally	
  Broken	
                                     on	
  steroid	
  



                                Why	
  
Apache	
  H@p	
  is	
  
  blocking	
  

                     Apache	
  H@pClient	
  
                     buffer	
  the	
  bytes	
  in	
  
                         memory	
  
JDK’s	
                                                 Apache	
  
 UrlConnec$on	
                                           H@pClient	
  high	
  
 Totally	
  Broken	
                                        on	
  steroid	
  



                                Why	
  
Apache	
  H@p	
  is	
  
                                                       Apache	
  H@pClient	
  
  blocking	
  
                                                        is	
  $ed	
  to	
  its	
  own	
  	
  
                                                               I/O	
  layer.	
  
                     Apache	
  H@pClient	
  
                     buffer	
  the	
  bytes	
  in	
  
                         memory	
  
AsyncH@pClient	
  
 supports	
  the	
  
  “zero-­‐copy”	
  	
  



                          Why	
  
AsyncH@pClient	
            Large	
  Upload	
  
    supports	
  the	
           using	
  na$ve	
  
                                 memory	
  
     “zero-­‐copy”	
  	
  
 Small	
  
memory	
  	
  



                             Why	
  
AsyncH@pClient	
               AsyncH@pClient	
  
 supports	
  the	
             is	
  not	
  $ed	
  to	
  it’s	
  
  “zero-­‐copy”	
  	
                 I/O	
  layer	
  	
  



                          Why	
  
AsyncH@pClient	
                         AsyncH@pClient	
  
 supports	
  the	
                       is	
  not	
  $ed	
  to	
  it’s	
  
  “zero-­‐copy”	
  	
                           I/O	
  layer	
  	
  
                          Ne@y	
  	
                                       JDK	
  
                                                                        UrlConnec
                                                                           $on	
  


                          Why	
  
                                                                   Apache	
  
                                                                  H@pClient	
  

                                          Grizzly	
  
AsyncH@pClient	
                AsyncH@pClient	
  
  supports	
  the	
              is	
  not	
  $ed	
  to	
  it’s	
  
   “zero-­‐copy”	
  	
                  I/O	
  layer	
  	
  



                            Why	
  
AsyncH@pClient	
  
 is	
  blocking	
  or	
  
 non	
  blocking	
  
AsyncH@pClient	
                                     AsyncH@pClient	
  
  supports	
  the	
                                   is	
  not	
  $ed	
  to	
  it’s	
  
   “zero-­‐copy”	
  	
                                       I/O	
  layer	
  	
  



                            Why	
  
AsyncH@pClient	
  
 is	
  blocking	
  or	
  
 non	
  blocking	
  
                             Use	
  the	
  well	
  
   Allow	
  efficient	
           know	
  	
  
     streaming	
            Future<?>	
  API	
  
AsyncH@pClient	
                                   AsyncH@pClient	
  
  supports	
  the	
                                 is	
  not	
  $ed	
  to	
  it’s	
  
   “zero-­‐copy”	
  	
                                     I/O	
  layer	
  	
  



                               Why	
  
AsyncH@pClient	
  
 is	
  blocking	
  or	
  
 non	
  blocking	
  

                       AsyncH@pClient	
  
                      doesn’t	
  buffer	
  the	
  
                      bytes	
  in	
  memory	
  
AsyncH@pClient	
                                   AsyncH@pClient	
  
  supports	
  the	
                                 is	
  not	
  $ed	
  to	
  it’s	
  
   “zero-­‐copy”	
  	
                                     I/O	
  layer	
  	
  



                               Why	
  
AsyncH@pClient	
  
 is	
  blocking	
  or	
  
 non	
  blocking	
  
                                                             Your	
  applica$on	
  
                                                               have	
  control	
  
                       AsyncH@pClient	
  
                      doesn’t	
  buffer	
  the	
  
                      bytes	
  in	
  memory	
  
AsyncH@pClient	
                                   AsyncH@pClient	
  
  supports	
  the	
                                 is	
  not	
  $ed	
  to	
  it’s	
  
   “zero-­‐copy”	
  	
                                     I/O	
  layer	
  	
  



                               Why	
  
AsyncH@pClient	
  
 is	
  blocking	
  or	
  
                                                     AsyncH@pClient	
  is	
  
 non	
  blocking	
  
                                                        easy	
  to	
  use	
  
                       AsyncH@pClient	
  
                      doesn’t	
  buffer	
  the	
  
                      bytes	
  in	
  memory	
  
Fully	
  Asynchronous	
  
 Calling	
  Thread	
                    Server	
  Thread	
  Pool	
  (*)	
  


                         request	
  


                                                  Response	
  chunk	
  
                         callback	
  



                                                   Response	
  chunk	
  
                         callback	
  
Comple$onHandler	
  
 Calling	
  Thread	
                    Server	
  Thread	
  Pool	
  (*)	
  


                         request	
  


                                                  Response	
  start	
  




                                                   Response	
  end	
  
                         callback	
  
Future	
  based	
  API	
  
AsyncH@pClient	
  asyncH@pClient	
  =	
  new	
  AsyncH@pClient();	
  

	
  Future<Response>	
  f	
  =	
  	
  
	
  	
  	
  	
  asyncH@pClient.prepareGet("h@p://www.sonatype.com/").execute();	
  

Response	
  r	
  =	
  f.get();	
  	
  
Handler	
  based	
  API	
  
AsyncH@pClient	
  asyncH@pClient	
  =	
  new	
  AsyncH@pClient();	
  
Future<Response>	
  asyncH@pClient.	
  
	
   prepareGet("h@p://www.sonatype.com/").execute(	
  

	
  	
  	
  	
  	
  	
   	
                    new	
  AsyncComple=onHandler<Response>(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
     	
                             {	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
     	
                             @Override	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
     	
                             public	
  Response	
  onCompleted(Response	
  r){	
  
                                               	
                             	
        return	
  response;	
  	
  
                                               	
  	
  	
  	
  	
  	
  	
  }	
  

                                               	
  	
  	
  	
  	
  	
  @Override	
  	
  
                                               	
                       public	
  void	
  onThrowable(Throwable	
  t){	
  	
  

                                               	
  	
  	
  	
  	
  	
  	
  }	
  	
  
	
                                 });	
  
Typed	
  
AsyncH@pClient	
  asyncH@pClient	
  =	
  new	
  AsyncH@pClient();	
  
asyncH@pClient.prepareGet("h@p://www.sonatype.com/").execute(	
  
	
  	
  	
  	
  	
  new	
  AsyncComple$onHandler<Integer>(	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  {	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  @Override	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  public	
  Integer	
  onCompleted(Response	
  r){	
  
	
                                 	
             return	
  response.getStatus();	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  @Override	
  	
  
	
                                 	
  	
  public	
  void	
  onThrowable(Throwable	
  t){	
  	
  

	
   	
  	
  	
  }	
  	
  
}).get();	
  //	
  Return	
  Integer	
  
Request	
  Builder	
  

AsyncH@pClient	
  c=	
  new	
  AsyncH@pClient();	
  

c.preparePost(“h@ps://….”)	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .setBody(body)	
  
	
   	
   	
   	
  .setHeader(header)	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .setProxy(proxy)	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .execute();	
  
Streaming	
  Handler	
  
AsyncH@pClient	
  c	
  =	
  new	
  AsyncH@pClient();	
  	
  
Future<String>	
  f	
  =	
  c.prepareGet("h@p://www.sonatype.com/").execute(	
  

	
  	
  	
  	
  	
  new	
  AsyncHandler<String>()	
  {	
  

	
  	
  	
  	
     @Override	
  	
  
	
                 public	
  STATE	
  onStatusReceived(H@pResponseStatus<String>	
  status)	
  
	
                 	
  	
       throws	
  Excep$on	
  	
  
	
                 {	
  //	
  return	
  STATE.ABORT	
  to	
  stop	
  }	
  

	
  	
  	
  	
  	
  	
  	
  @Override	
  	
  
	
  	
  	
  	
  	
  	
  	
  public	
  STATE	
  onHeadersReceived(H@pResponseHeaders<String>	
  headers)	
  	
  
	
                               	
     throws	
  Excep$on	
  	
  
	
  	
  	
  	
  	
  	
  	
  {	
  …}	
  

	
    @Override	
  	
  
	
    public	
  STATE	
  onBodyPartReceived(H@pResponseBodyPart<String>	
  bodyPart)	
  	
  
	
    	
      throws	
  Excep$on	
  	
  
	
    {…}	
  
}.get();	
  
Progress	
  Handler	
  
Future<String>	
  f	
  =	
  	
  h@pClient.preparePut(uri)	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .setRealm(createRealm())	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .setProxyServer(createProxyServer())	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .setFile(file)	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .execute(comple$onHandler);	
  ("….").setFile(.execute(	
  

	
  	
  	
  	
  	
  new	
  AsyncComple=onHandler<String>()	
  {	
  

	
  	
  	
  	
   @Override	
  	
  
	
  	
                               public	
  STATE	
  onHeaderWriteCompleted()	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
   	
    return	
  STATE.CONTINUE;	
  
	
  	
  	
  	
  	
   }	
  	
  

	
  	
  	
  	
  	
  	
  	
  	
  	
  @Override	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  public	
  STATE	
  onContentWriteCompleted()	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  return	
  STATE.CONTINUE;	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  }	
  

	
  	
  	
  	
  	
  	
  	
  	
  @Override	
  
	
  	
  	
  	
  	
  	
  	
  	
  public	
  STATE	
  onContentWriteProgess(long	
  amount,	
  long	
  current,	
  long	
  total)	
  {	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  return	
  STATE.CONTINUE;	
  
	
  	
  	
  	
  	
  	
  	
  	
  }	
  
)	
  
Configurable	
  
AsyncH@pClientConfig	
  c	
  =	
  	
  
	
   new	
  AsyncH@pClientConfig.Builder().	
  
	
   	
   setResponseTimeoutInMs(30000).build();	
  

AsyncH@pClient	
  asyncH@pClient	
  =	
  new	
  AsyncH@pClient(c);	
  

Realm	
  realm	
  =	
  new	
  Realm.RealmBuilder()	
  
	
   	
   	
   	
   	
   	
   	
   	
   	
  	
  	
  	
  .setPrincipal(“me”)	
  
	
   	
   	
   	
   	
   	
   	
   	
   	
  	
  	
  	
  .setPassword(“xxxx”).build();	
  
c.setRealm(realm);	
  

AsyncH@pClient	
  asyncH@pClient	
  =	
  new	
  AsyncH@pClient(c);	
  
Zero	
  Copy	
  -­‐	
  Upload	
  

AsyncH@pClient	
  c=	
  new	
  AsyncH@pClient();	
  

c.preparePost(“h@ps://….”)	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .setBody(body)	
  
	
   	
   	
  	
  	
  .setFile(header)	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .setProxy(proxy).execute();	
  
Zero	
  Copy	
  -­‐	
  Download	
  
AsyncH@pClient	
  c	
  =	
  new	
  AsyncH@pClient();	
  	
  
Future<String>	
  f	
  =	
  c.prepareGet("h@p://www.sonatype.com/").execute(	
  

	
  	
  	
  	
  	
  new	
  AsyncHandler<String>()	
  {	
  

	
            @Override	
  	
  
	
            public	
  STATE	
  onBodyPartReceived(H@pResponseBodyPart<String>	
  bodyPart)	
  	
  
	
            	
        throws	
  Excep$on	
  	
  
	
            {	
  	
  

	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  bodyPart.write(OutputStream);	
  
	
                                      }	
  
}.get();	
  
TLS	
  Support	
  
//	
  Op$onal	
  
AsyncH@pClientConfig	
  c	
  =	
  	
  
	
   new	
  AsyncH@pClientConfig.Builder().	
  
	
   	
   setSSLEngine(…).build();	
  

AsyncH@pClient	
  asyncH@pClient	
  =	
  	
  
	
   new	
  AsyncH@pClient(c);	
  

Future<String>	
  f	
  =	
  	
  
	
  	
  c.prepareGet("hBps://….").get();	
  
Scrip$ng	
  Support	
  -­‐	
  Clojure	
  
•  (ns	
  twi@er-­‐stream	
  
   	
  	
  (:require	
  [h@p.async.client	
  :as	
  c]	
  
   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  [org.danlarkin.json	
  :as	
  j]	
  
   	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  [clojure.contrib.logging	
  :as	
  l]))	
  
       (doseq	
  [twit-­‐str	
  (c/string	
  
       	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  (c/stream-­‐seq	
  :get	
  "h@p://stream.twi@er.com/1/statuses/
       sample.json"	
  
       	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  :auth	
  {:user	
  "u"	
  :password	
  "p"}	
  
       	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  :$meout	
  -­‐1))]	
  
       	
  	
  (try	
  
       	
  	
  	
  	
  (let	
  [twit	
  ( j/decode-­‐from-­‐str	
  twit-­‐str)]	
  
       	
  	
  	
  	
  	
  	
  (l/info	
  (str	
  (get-­‐in	
  twit	
  [:user	
  :screen_name])	
  "=>"	
  (:text	
  twit))))	
  
       	
  	
  	
  	
  (catch	
  Excep$on	
  e	
  
       	
  	
  	
  	
  	
  	
  (l/warn	
  (str	
  "Failed	
  to	
  parse:	
  "	
  twit-­‐str)	
  e))))	
  
Scrip$ng	
  Support	
  -­‐	
  JRuby	
  
client	
  =	
  AsyncH@pClient.new	
  	
  
future	
  =	
  client.prepare_get("h@p://…")	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  .set_header("X-­‐Trace",	
  "true").execute	
  
	
  	
  	
  	
  response	
  =	
  future.get	
  
	
  	
  	
  	
  	
  	
  	
  	
  response.headers.each	
  
	
  	
  	
  	
  	
  {	
  |pair|	
  puts	
  "#{pair.key}	
  =>	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  #{pair.value.join(",	
  ")}"	
  }	
  client.close	
  	
  
Scrip$ng	
  Support	
  -­‐	
  Jython	
  
	
  	
  	
  	
  client	
  =	
  AsyncH@pClient()	
  future	
  =	
  
               client.prepareGet("h@p://www.google.com/")	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .setHeaders({	
  "User-­‐Agent"	
  :	
  [	
  "Async	
  HTTP	
  
               Client/1.0.0"	
  ]})	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  .execute()	
  	
  
response	
  =	
  future.get()	
  for	
  entry	
  in	
  
               response.headers:	
  print	
  '%s	
  =>	
  %s'	
  %	
  (entry.key,	
  
               ",	
  ".join(entry.value))	
  client.close()	
  	
  
What’s	
  Next	
  
•  NTLM	
  support	
  
•  Websocket	
  support	
  
•  New	
  Providers:	
  
   – Grizzly	
  2.0	
  
   – Apache	
  H@pClient	
  
•  H@p	
  Pipelining	
  
•  Annota$on	
  based	
  support.	
  
Fancy	
  
@BaseURL("h@p://localhost:12345")	
  	
  
public	
  interface	
  FooClient	
  	
  
{	
  	
  
	
        @GET("/")	
  	
  
	
        public	
  Future<Response>	
  getRoot();	
  

	
  	
     @GET("/")	
  	
  
	
         public	
  Future<String>	
  getRootAsString();	
  

	
        @GET("/")	
  	
  
	
        public	
  Future<String>	
  
	
  	
    	
     getRootWithParam(@QueryParam("name")	
  String	
  name);	
  	
  
}	
  	
  
FancyClientBuilder	
  builder	
  =	
  new	
  FancyClientBuilder(asyncClient);	
  FooClient	
  
client	
  =	
  builder.build(FooClient.class);	
  	
  

Weitere ähnliche Inhalte

Ähnlich wie Async Http Client for Java and Scripting Language

Performance Evaluation of Cloudera Impala GA
Performance Evaluation of Cloudera Impala GAPerformance Evaluation of Cloudera Impala GA
Performance Evaluation of Cloudera Impala GAYukinori Suda
 
OCCI-OS tutorial
OCCI-OS tutorialOCCI-OS tutorial
OCCI-OS tutorialAlan Sill
 
Vault Secrets Via API for the REST of Us
Vault Secrets Via API for the REST of UsVault Secrets Via API for the REST of Us
Vault Secrets Via API for the REST of UsMitchell Pronschinske
 
Evaluation of cloudera impala 1.1
Evaluation of cloudera impala 1.1Evaluation of cloudera impala 1.1
Evaluation of cloudera impala 1.1Yukinori Suda
 
OpenStack Development Using devstack
OpenStack Development Using devstackOpenStack Development Using devstack
OpenStack Development Using devstackmestery
 
Why async matters
Why async mattersWhy async matters
Why async matterstimbc
 
Heat up your stack
Heat up your stackHeat up your stack
Heat up your stackRico Lin
 
Accumulo Summit 2016: Effective Testing of Apache Accumulo Iterators
Accumulo Summit 2016: Effective Testing of Apache Accumulo IteratorsAccumulo Summit 2016: Effective Testing of Apache Accumulo Iterators
Accumulo Summit 2016: Effective Testing of Apache Accumulo IteratorsAccumulo Summit
 
Asynchronous Architectures for Implementing Scalable Cloud Services - Evan Co...
Asynchronous Architectures for Implementing Scalable Cloud Services - Evan Co...Asynchronous Architectures for Implementing Scalable Cloud Services - Evan Co...
Asynchronous Architectures for Implementing Scalable Cloud Services - Evan Co...Twilio Inc
 
Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Baruch Sadogursky
 
ApacheCon 2021: Apache NiFi 101- introduction and best practices
ApacheCon 2021:   Apache NiFi 101- introduction and best practicesApacheCon 2021:   Apache NiFi 101- introduction and best practices
ApacheCon 2021: Apache NiFi 101- introduction and best practicesTimothy Spann
 

Ähnlich wie Async Http Client for Java and Scripting Language (14)

Apache Flink Hands-On
Apache Flink Hands-OnApache Flink Hands-On
Apache Flink Hands-On
 
Performance Evaluation of Cloudera Impala GA
Performance Evaluation of Cloudera Impala GAPerformance Evaluation of Cloudera Impala GA
Performance Evaluation of Cloudera Impala GA
 
OCCI-OS tutorial
OCCI-OS tutorialOCCI-OS tutorial
OCCI-OS tutorial
 
Vault Secrets Via API for the REST of Us
Vault Secrets Via API for the REST of UsVault Secrets Via API for the REST of Us
Vault Secrets Via API for the REST of Us
 
Evaluation of cloudera impala 1.1
Evaluation of cloudera impala 1.1Evaluation of cloudera impala 1.1
Evaluation of cloudera impala 1.1
 
OpenStack Development Using devstack
OpenStack Development Using devstackOpenStack Development Using devstack
OpenStack Development Using devstack
 
Why async matters
Why async mattersWhy async matters
Why async matters
 
Heat up your stack
Heat up your stackHeat up your stack
Heat up your stack
 
Accumulo Summit 2016: Effective Testing of Apache Accumulo Iterators
Accumulo Summit 2016: Effective Testing of Apache Accumulo IteratorsAccumulo Summit 2016: Effective Testing of Apache Accumulo Iterators
Accumulo Summit 2016: Effective Testing of Apache Accumulo Iterators
 
Railsconf
RailsconfRailsconf
Railsconf
 
Asynchronous Architectures for Implementing Scalable Cloud Services - Evan Co...
Asynchronous Architectures for Implementing Scalable Cloud Services - Evan Co...Asynchronous Architectures for Implementing Scalable Cloud Services - Evan Co...
Asynchronous Architectures for Implementing Scalable Cloud Services - Evan Co...
 
Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java Everything you wanted to know about writing async, concurrent http apps in java
Everything you wanted to know about writing async, concurrent http apps in java
 
ApacheCon 2021: Apache NiFi 101- introduction and best practices
ApacheCon 2021:   Apache NiFi 101- introduction and best practicesApacheCon 2021:   Apache NiFi 101- introduction and best practices
ApacheCon 2021: Apache NiFi 101- introduction and best practices
 
Plack at YAPC::NA 2010
Plack at YAPC::NA 2010Plack at YAPC::NA 2010
Plack at YAPC::NA 2010
 

Mehr von jfarcand

Websockets on the JVM: Atmosphere to the rescue!
Websockets on the JVM: Atmosphere to the rescue!Websockets on the JVM: Atmosphere to the rescue!
Websockets on the JVM: Atmosphere to the rescue!jfarcand
 
Building WebSocket and Server Side Events Applications using Atmosphere
Building WebSocket and Server Side Events Applications using AtmosphereBuilding WebSocket and Server Side Events Applications using Atmosphere
Building WebSocket and Server Side Events Applications using Atmospherejfarcand
 
Writing Portable WebSockets in Java
Writing Portable WebSockets in JavaWriting Portable WebSockets in Java
Writing Portable WebSockets in Javajfarcand
 
Introduction au WebSockets via le projet Atmosphere
Introduction au WebSockets via le projet AtmosphereIntroduction au WebSockets via le projet Atmosphere
Introduction au WebSockets via le projet Atmospherejfarcand
 
Writing highly scalable WebSocket using the Atmosphere Framework and Scala
Writing highly scalable WebSocket using the Atmosphere Framework and ScalaWriting highly scalable WebSocket using the Atmosphere Framework and Scala
Writing highly scalable WebSocket using the Atmosphere Framework and Scalajfarcand
 
Servlet Async I/O Proposal (NIO.2)
Servlet Async I/O Proposal (NIO.2)Servlet Async I/O Proposal (NIO.2)
Servlet Async I/O Proposal (NIO.2)jfarcand
 
The Atmosphere Framework
The Atmosphere FrameworkThe Atmosphere Framework
The Atmosphere Frameworkjfarcand
 

Mehr von jfarcand (7)

Websockets on the JVM: Atmosphere to the rescue!
Websockets on the JVM: Atmosphere to the rescue!Websockets on the JVM: Atmosphere to the rescue!
Websockets on the JVM: Atmosphere to the rescue!
 
Building WebSocket and Server Side Events Applications using Atmosphere
Building WebSocket and Server Side Events Applications using AtmosphereBuilding WebSocket and Server Side Events Applications using Atmosphere
Building WebSocket and Server Side Events Applications using Atmosphere
 
Writing Portable WebSockets in Java
Writing Portable WebSockets in JavaWriting Portable WebSockets in Java
Writing Portable WebSockets in Java
 
Introduction au WebSockets via le projet Atmosphere
Introduction au WebSockets via le projet AtmosphereIntroduction au WebSockets via le projet Atmosphere
Introduction au WebSockets via le projet Atmosphere
 
Writing highly scalable WebSocket using the Atmosphere Framework and Scala
Writing highly scalable WebSocket using the Atmosphere Framework and ScalaWriting highly scalable WebSocket using the Atmosphere Framework and Scala
Writing highly scalable WebSocket using the Atmosphere Framework and Scala
 
Servlet Async I/O Proposal (NIO.2)
Servlet Async I/O Proposal (NIO.2)Servlet Async I/O Proposal (NIO.2)
Servlet Async I/O Proposal (NIO.2)
 
The Atmosphere Framework
The Atmosphere FrameworkThe Atmosphere Framework
The Atmosphere Framework
 

Kürzlich hochgeladen

How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 

Kürzlich hochgeladen (20)

How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 

Async Http Client for Java and Scripting Language

  • 1. Wri$ng  Powerful  HTTP  Apps  Using   the  New  Asynchronous  HTTP  Client   Library   h@p://github.com/AsyncH@pClient/async-­‐h@p-­‐client   Jeanfrancois  Arcand   Hubert  Iwaniuk   h@p://twi@er.com/jfarcand   h@p://twi@er.com/neotyk  
  • 2. Creator  of     Creator  of   the  Grizzly   GlassFish  v3   Creator  and  Co-­‐ Framework     Grizzly  Micro   Leader  of     Kernel   Atmosphere   Jeanfrancois   9  years  @  Sun   Creator  Async   Microsystem   H@p  Client   Major   contributor  to   GlassFish  
  • 3. •  News  and  Update   •  Why     •  The  Async  H@p  Client  API   •  Conclusion     •  Q  &  A  
  • 4. Since  released,  we’ve  got  an   impressive  amount  of   contribu$ons  and  adop$ons.   Library  is  evolving  fast!  
  • 6. JDK’s   Apache   UrlConnec$on   H@pClient  high   Totally  Broken   on  steroid   Why  
  • 7. JDK’s   Apache   UrlConnec$on   H@pClient  high   Totally  Broken   on  steroid   Why   Apache  H@p  is   blocking  
  • 8. JDK’s   Apache   UrlConnec$on   H@pClient  high   Totally  Broken   on  steroid   Why   Apache  H@p  is   blocking   Apache  H@pClient   buffer  the  bytes  in   memory  
  • 9. JDK’s   Apache   UrlConnec$on   H@pClient  high   Totally  Broken   on  steroid   Why   Apache  H@p  is   Apache  H@pClient   blocking   is  $ed  to  its  own     I/O  layer.   Apache  H@pClient   buffer  the  bytes  in   memory  
  • 10. AsyncH@pClient   supports  the   “zero-­‐copy”     Why  
  • 11. AsyncH@pClient   Large  Upload   supports  the   using  na$ve   memory   “zero-­‐copy”     Small   memory     Why  
  • 12. AsyncH@pClient   AsyncH@pClient   supports  the   is  not  $ed  to  it’s   “zero-­‐copy”     I/O  layer     Why  
  • 13. AsyncH@pClient   AsyncH@pClient   supports  the   is  not  $ed  to  it’s   “zero-­‐copy”     I/O  layer     Ne@y     JDK   UrlConnec $on   Why   Apache   H@pClient   Grizzly  
  • 14. AsyncH@pClient   AsyncH@pClient   supports  the   is  not  $ed  to  it’s   “zero-­‐copy”     I/O  layer     Why   AsyncH@pClient   is  blocking  or   non  blocking  
  • 15. AsyncH@pClient   AsyncH@pClient   supports  the   is  not  $ed  to  it’s   “zero-­‐copy”     I/O  layer     Why   AsyncH@pClient   is  blocking  or   non  blocking   Use  the  well   Allow  efficient   know     streaming   Future<?>  API  
  • 16. AsyncH@pClient   AsyncH@pClient   supports  the   is  not  $ed  to  it’s   “zero-­‐copy”     I/O  layer     Why   AsyncH@pClient   is  blocking  or   non  blocking   AsyncH@pClient   doesn’t  buffer  the   bytes  in  memory  
  • 17. AsyncH@pClient   AsyncH@pClient   supports  the   is  not  $ed  to  it’s   “zero-­‐copy”     I/O  layer     Why   AsyncH@pClient   is  blocking  or   non  blocking   Your  applica$on   have  control   AsyncH@pClient   doesn’t  buffer  the   bytes  in  memory  
  • 18. AsyncH@pClient   AsyncH@pClient   supports  the   is  not  $ed  to  it’s   “zero-­‐copy”     I/O  layer     Why   AsyncH@pClient   is  blocking  or   AsyncH@pClient  is   non  blocking   easy  to  use   AsyncH@pClient   doesn’t  buffer  the   bytes  in  memory  
  • 19. Fully  Asynchronous   Calling  Thread   Server  Thread  Pool  (*)   request   Response  chunk   callback   Response  chunk   callback  
  • 20. Comple$onHandler   Calling  Thread   Server  Thread  Pool  (*)   request   Response  start   Response  end   callback  
  • 21. Future  based  API   AsyncH@pClient  asyncH@pClient  =  new  AsyncH@pClient();    Future<Response>  f  =            asyncH@pClient.prepareGet("h@p://www.sonatype.com/").execute();   Response  r  =  f.get();    
  • 22. Handler  based  API   AsyncH@pClient  asyncH@pClient  =  new  AsyncH@pClient();   Future<Response>  asyncH@pClient.     prepareGet("h@p://www.sonatype.com/").execute(                 new  AsyncComple=onHandler<Response>(                           {                             @Override                             public  Response  onCompleted(Response  r){       return  response;                  }              @Override       public  void  onThrowable(Throwable  t){                  }       });  
  • 23. Typed   AsyncH@pClient  asyncH@pClient  =  new  AsyncH@pClient();   asyncH@pClient.prepareGet("h@p://www.sonatype.com/").execute(            new  AsyncComple$onHandler<Integer>(                      {                        @Override                        public  Integer  onCompleted(Response  r){       return  response.getStatus();                        }                      @Override          public  void  onThrowable(Throwable  t){            }     }).get();  //  Return  Integer  
  • 24. Request  Builder   AsyncH@pClient  c=  new  AsyncH@pClient();   c.preparePost(“h@ps://….”)                                  .setBody(body)          .setHeader(header)                                  .setProxy(proxy)                                  .execute();  
  • 25. Streaming  Handler   AsyncH@pClient  c  =  new  AsyncH@pClient();     Future<String>  f  =  c.prepareGet("h@p://www.sonatype.com/").execute(            new  AsyncHandler<String>()  {           @Override       public  STATE  onStatusReceived(H@pResponseStatus<String>  status)         throws  Excep$on       {  //  return  STATE.ABORT  to  stop  }                @Override                  public  STATE  onHeadersReceived(H@pResponseHeaders<String>  headers)         throws  Excep$on                  {  …}     @Override       public  STATE  onBodyPartReceived(H@pResponseBodyPart<String>  bodyPart)         throws  Excep$on       {…}   }.get();  
  • 26. Progress  Handler   Future<String>  f  =    h@pClient.preparePut(uri)                                                  .setRealm(createRealm())                                                  .setProxyServer(createProxyServer())                                                  .setFile(file)                                                  .execute(comple$onHandler);  ("….").setFile(.execute(            new  AsyncComple=onHandler<String>()  {           @Override         public  STATE  onHeaderWriteCompleted()  {                       return  STATE.CONTINUE;             }                      @Override                    public  STATE  onContentWriteCompleted()  {                                        return  STATE.CONTINUE;                    }                  @Override                  public  STATE  onContentWriteProgess(long  amount,  long  current,  long  total)  {                                return  STATE.CONTINUE;                  }   )  
  • 27. Configurable   AsyncH@pClientConfig  c  =       new  AsyncH@pClientConfig.Builder().       setResponseTimeoutInMs(30000).build();   AsyncH@pClient  asyncH@pClient  =  new  AsyncH@pClient(c);   Realm  realm  =  new  Realm.RealmBuilder()                          .setPrincipal(“me”)                          .setPassword(“xxxx”).build();   c.setRealm(realm);   AsyncH@pClient  asyncH@pClient  =  new  AsyncH@pClient(c);  
  • 28. Zero  Copy  -­‐  Upload   AsyncH@pClient  c=  new  AsyncH@pClient();   c.preparePost(“h@ps://….”)                                  .setBody(body)            .setFile(header)                                  .setProxy(proxy).execute();  
  • 29. Zero  Copy  -­‐  Download   AsyncH@pClient  c  =  new  AsyncH@pClient();     Future<String>  f  =  c.prepareGet("h@p://www.sonatype.com/").execute(            new  AsyncHandler<String>()  {     @Override       public  STATE  onBodyPartReceived(H@pResponseBodyPart<String>  bodyPart)         throws  Excep$on       {                                            bodyPart.write(OutputStream);     }   }.get();  
  • 30. TLS  Support   //  Op$onal   AsyncH@pClientConfig  c  =       new  AsyncH@pClientConfig.Builder().       setSSLEngine(…).build();   AsyncH@pClient  asyncH@pClient  =       new  AsyncH@pClient(c);   Future<String>  f  =        c.prepareGet("hBps://….").get();  
  • 31. Scrip$ng  Support  -­‐  Clojure   •  (ns  twi@er-­‐stream      (:require  [h@p.async.client  :as  c]                          [org.danlarkin.json  :as  j]                          [clojure.contrib.logging  :as  l]))   (doseq  [twit-­‐str  (c/string                                      (c/stream-­‐seq  :get  "h@p://stream.twi@er.com/1/statuses/ sample.json"                                                                  :auth  {:user  "u"  :password  "p"}                                                                  :$meout  -­‐1))]      (try          (let  [twit  ( j/decode-­‐from-­‐str  twit-­‐str)]              (l/info  (str  (get-­‐in  twit  [:user  :screen_name])  "=>"  (:text  twit))))          (catch  Excep$on  e              (l/warn  (str  "Failed  to  parse:  "  twit-­‐str)  e))))  
  • 32. Scrip$ng  Support  -­‐  JRuby   client  =  AsyncH@pClient.new     future  =  client.prepare_get("h@p://…")                    .set_header("X-­‐Trace",  "true").execute          response  =  future.get                  response.headers.each            {  |pair|  puts  "#{pair.key}  =>                                          #{pair.value.join(",  ")}"  }  client.close    
  • 33. Scrip$ng  Support  -­‐  Jython          client  =  AsyncH@pClient()  future  =   client.prepareGet("h@p://www.google.com/")                          .setHeaders({  "User-­‐Agent"  :  [  "Async  HTTP   Client/1.0.0"  ]})                          .execute()     response  =  future.get()  for  entry  in   response.headers:  print  '%s  =>  %s'  %  (entry.key,   ",  ".join(entry.value))  client.close()    
  • 34. What’s  Next   •  NTLM  support   •  Websocket  support   •  New  Providers:   – Grizzly  2.0   – Apache  H@pClient   •  H@p  Pipelining   •  Annota$on  based  support.  
  • 35. Fancy   @BaseURL("h@p://localhost:12345")     public  interface  FooClient     {       @GET("/")       public  Future<Response>  getRoot();       @GET("/")       public  Future<String>  getRootAsString();     @GET("/")       public  Future<String>         getRootWithParam(@QueryParam("name")  String  name);     }     FancyClientBuilder  builder  =  new  FancyClientBuilder(asyncClient);  FooClient   client  =  builder.build(FooClient.class);