public class DefaultAhcBinding extends Object implements AhcBinding
Modifier and Type | Field and Description |
---|---|
protected org.apache.camel.spi.HeaderFilterStrategy |
httpProtocolHeaderFilterStrategy |
protected org.slf4j.Logger |
log |
Constructor and Description |
---|
DefaultAhcBinding() |
Modifier and Type | Method and Description |
---|---|
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
com.ning.http.client.AsyncHttpClient when complete and all the response has been received. |
void |
onHeadersReceived(AhcEndpoint endpoint,
org.apache.camel.Exchange exchange,
io.netty.handler.codec.http.HttpHeaders headers)
Callback from the
com.ning.http.client.AsyncHttpClient when the HTTP headers was received |
void |
onStatusReceived(AhcEndpoint endpoint,
org.apache.camel.Exchange exchange,
org.asynchttpclient.HttpResponseStatus responseStatus)
Callback from the
com.ning.http.client.AsyncHttpClient when the HTTP response status was received |
void |
onThrowable(AhcEndpoint endpoint,
org.apache.camel.Exchange exchange,
Throwable t)
Callback from the
com.ning.http.client.AsyncHttpClient when an exception occurred sending the request. |
protected void |
populateBody(org.asynchttpclient.RequestBuilder builder,
AhcEndpoint endpoint,
org.apache.camel.Exchange exchange) |
protected void |
populateHeaders(org.asynchttpclient.RequestBuilder builder,
AhcEndpoint endpoint,
org.apache.camel.Exchange exchange,
URI uri) |
org.asynchttpclient.Request |
prepareRequest(AhcEndpoint endpoint,
org.apache.camel.Exchange exchange)
Prepares the AHC
Request to be send. |
protected final org.slf4j.Logger log
protected org.apache.camel.spi.HeaderFilterStrategy httpProtocolHeaderFilterStrategy
public org.asynchttpclient.Request prepareRequest(AhcEndpoint endpoint, org.apache.camel.Exchange exchange) throws org.apache.camel.CamelExchangeException
AhcBinding
Request
to be send.prepareRequest
in interface AhcBinding
endpoint
- the endpointexchange
- the exchangecom.ning.http.client.AsyncHttpClient
org.apache.camel.CamelExchangeException
protected String extractMethod(org.apache.camel.Exchange exchange)
protected void populateHeaders(org.asynchttpclient.RequestBuilder builder, AhcEndpoint endpoint, org.apache.camel.Exchange exchange, URI uri) throws org.apache.camel.CamelExchangeException
org.apache.camel.CamelExchangeException
protected void populateBody(org.asynchttpclient.RequestBuilder builder, AhcEndpoint endpoint, org.apache.camel.Exchange exchange) throws org.apache.camel.CamelExchangeException
org.apache.camel.CamelExchangeException
public void onThrowable(AhcEndpoint endpoint, org.apache.camel.Exchange exchange, Throwable t) throws Exception
AhcBinding
com.ning.http.client.AsyncHttpClient
when an exception occurred sending the request.onThrowable
in interface AhcBinding
endpoint
- the endpointexchange
- the exchanget
- the thrown exceptionException
- is thrown if error occurred in the callbackpublic void onStatusReceived(AhcEndpoint endpoint, org.apache.camel.Exchange exchange, org.asynchttpclient.HttpResponseStatus responseStatus) throws Exception
AhcBinding
com.ning.http.client.AsyncHttpClient
when the HTTP response status was receivedonStatusReceived
in interface AhcBinding
endpoint
- the endpointexchange
- the exchangeresponseStatus
- the HTTP response statusException
- is thrown if error occurred in the callbackpublic void onHeadersReceived(AhcEndpoint endpoint, org.apache.camel.Exchange exchange, io.netty.handler.codec.http.HttpHeaders headers) throws Exception
AhcBinding
com.ning.http.client.AsyncHttpClient
when the HTTP headers was receivedonHeadersReceived
in interface AhcBinding
endpoint
- the endpointexchange
- the exchangeheaders
- the HTTP headersException
- is thrown if error occurred in the callbackpublic void onComplete(AhcEndpoint endpoint, org.apache.camel.Exchange exchange, String url, ByteArrayOutputStream os, int contentLength, int statusCode, String statusText) throws Exception
AhcBinding
com.ning.http.client.AsyncHttpClient
when complete and all the response has been received.onComplete
in interface AhcBinding
endpoint
- the endpointexchange
- the exchangeurl
- the url requestedos
- output stream with the HTTP response bodycontentLength
- length of the response bodystatusCode
- the http response codestatusText
- the http status textException
- is thrown if error occurred in the callbackApache Camel