org.apache.camel.component.ahc
Class DefaultAhcBinding

java.lang.Object
  extended by org.apache.camel.component.ahc.DefaultAhcBinding
All Implemented Interfaces:
AhcBinding

public class DefaultAhcBinding
extends Object
implements AhcBinding


Field Summary
protected  org.slf4j.Logger log
           
 
Constructor Summary
DefaultAhcBinding()
           
 
Method Summary
protected  String extractMethod(org.apache.camel.Exchange exchange)
           
 void onComplete(AhcEndpoint endpoint, org.apache.camel.Exchange exchange, String url, ByteArrayOutputStream os, int contentLength, int statusCode, String statusText)
          Callback from the AsyncHttpClient when complete and all the response has been received.
 void onHeadersReceived(AhcEndpoint endpoint, org.apache.camel.Exchange exchange, com.ning.http.client.HttpResponseHeaders headers)
          Callback from the AsyncHttpClient when the HTTP headers was received
 void onStatusReceived(AhcEndpoint endpoint, org.apache.camel.Exchange exchange, com.ning.http.client.HttpResponseStatus responseStatus)
          Callback from the AsyncHttpClient when the HTTP response status was received
 void onThrowable(AhcEndpoint endpoint, org.apache.camel.Exchange exchange, Throwable t)
          Callback from the AsyncHttpClient when an exception occurred sending the request.
protected  void populateBody(com.ning.http.client.RequestBuilder builder, AhcEndpoint endpoint, org.apache.camel.Exchange exchange)
           
protected  void populateHeaders(com.ning.http.client.RequestBuilder builder, AhcEndpoint endpoint, org.apache.camel.Exchange exchange)
           
 com.ning.http.client.Request prepareRequest(AhcEndpoint endpoint, org.apache.camel.Exchange exchange)
          Prepares the AHC Request to be send.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final transient org.slf4j.Logger log
Constructor Detail

DefaultAhcBinding

public DefaultAhcBinding()
Method Detail

prepareRequest

public com.ning.http.client.Request prepareRequest(AhcEndpoint endpoint,
                                                   org.apache.camel.Exchange exchange)
                                            throws org.apache.camel.CamelExchangeException
Description copied from interface: AhcBinding
Prepares the AHC Request to be send.

Specified by:
prepareRequest in interface AhcBinding
Parameters:
endpoint - the endpoint
exchange - the exchange
Returns:
the request to send using the AsyncHttpClient
Throws:
org.apache.camel.CamelExchangeException

extractMethod

protected String extractMethod(org.apache.camel.Exchange exchange)

populateHeaders

protected void populateHeaders(com.ning.http.client.RequestBuilder builder,
                               AhcEndpoint endpoint,
                               org.apache.camel.Exchange exchange)

populateBody

protected void populateBody(com.ning.http.client.RequestBuilder builder,
                            AhcEndpoint endpoint,
                            org.apache.camel.Exchange exchange)
                     throws org.apache.camel.CamelExchangeException
Throws:
org.apache.camel.CamelExchangeException

onThrowable

public void onThrowable(AhcEndpoint endpoint,
                        org.apache.camel.Exchange exchange,
                        Throwable t)
                 throws Exception
Description copied from interface: AhcBinding
Callback from the AsyncHttpClient when an exception occurred sending the request.

Specified by:
onThrowable in interface AhcBinding
Parameters:
endpoint - the endpoint
exchange - the exchange
t - the thrown exception
Throws:
Exception - is thrown if error occurred in the callback

onStatusReceived

public void onStatusReceived(AhcEndpoint endpoint,
                             org.apache.camel.Exchange exchange,
                             com.ning.http.client.HttpResponseStatus responseStatus)
                      throws Exception
Description copied from interface: AhcBinding
Callback from the AsyncHttpClient when the HTTP response status was received

Specified by:
onStatusReceived in interface AhcBinding
Parameters:
endpoint - the endpoint
exchange - the exchange
responseStatus - the HTTP response status
Throws:
Exception - is thrown if error occurred in the callback

onHeadersReceived

public void onHeadersReceived(AhcEndpoint endpoint,
                              org.apache.camel.Exchange exchange,
                              com.ning.http.client.HttpResponseHeaders headers)
                       throws Exception
Description copied from interface: AhcBinding
Callback from the AsyncHttpClient when the HTTP headers was received

Specified by:
onHeadersReceived in interface AhcBinding
Parameters:
endpoint - the endpoint
exchange - the exchange
headers - the HTTP headers
Throws:
Exception - is thrown if error occurred in the callback

onComplete

public void onComplete(AhcEndpoint endpoint,
                       org.apache.camel.Exchange exchange,
                       String url,
                       ByteArrayOutputStream os,
                       int contentLength,
                       int statusCode,
                       String statusText)
                throws Exception
Description copied from interface: AhcBinding
Callback from the AsyncHttpClient when complete and all the response has been received.

Specified by:
onComplete in interface AhcBinding
Parameters:
endpoint - the endpoint
exchange - the exchange
url - the url requested
os - output stream with the HTTP response body
contentLength - length of the response body
statusCode - the http response code
statusText - the http status text
Throws:
Exception - is thrown if error occurred in the callback


Apache CAMEL