Package org.apache.camel.component.ahc
Class DefaultAhcBinding
- java.lang.Object
-
- org.apache.camel.component.ahc.DefaultAhcBinding
-
- All Implemented Interfaces:
AhcBinding
public class DefaultAhcBinding extends Object implements AhcBinding
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.camel.spi.HeaderFilterStrategy
httpProtocolHeaderFilterStrategy
protected org.slf4j.Logger
log
-
Constructor Summary
Constructors Constructor Description DefaultAhcBinding()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 thecom.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 thecom.ning.http.client.AsyncHttpClient
when the HTTP headers was receivedvoid
onStatusReceived(AhcEndpoint endpoint, org.apache.camel.Exchange exchange, org.asynchttpclient.HttpResponseStatus responseStatus)
Callback from thecom.ning.http.client.AsyncHttpClient
when the HTTP response status was receivedvoid
onThrowable(AhcEndpoint endpoint, org.apache.camel.Exchange exchange, Throwable t)
Callback from thecom.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 AHCRequest
to be send.
-
-
-
Method Detail
-
prepareRequest
public org.asynchttpclient.Request prepareRequest(AhcEndpoint endpoint, org.apache.camel.Exchange exchange) throws org.apache.camel.CamelExchangeException
Description copied from interface:AhcBinding
Prepares the AHCRequest
to be send.- Specified by:
prepareRequest
in interfaceAhcBinding
- Parameters:
endpoint
- the endpointexchange
- the exchange- Returns:
- the request to send using the
com.ning.http.client.AsyncHttpClient
- Throws:
org.apache.camel.CamelExchangeException
-
extractMethod
protected String extractMethod(org.apache.camel.Exchange exchange)
-
populateHeaders
protected void populateHeaders(org.asynchttpclient.RequestBuilder builder, AhcEndpoint endpoint, org.apache.camel.Exchange exchange, URI uri) throws org.apache.camel.CamelExchangeException
- Throws:
org.apache.camel.CamelExchangeException
-
populateBody
protected void populateBody(org.asynchttpclient.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 thecom.ning.http.client.AsyncHttpClient
when an exception occurred sending the request.- Specified by:
onThrowable
in interfaceAhcBinding
- Parameters:
endpoint
- the endpointexchange
- the exchanget
- the thrown exception- Throws:
Exception
- is thrown if error occurred in the callback
-
onStatusReceived
public void onStatusReceived(AhcEndpoint endpoint, org.apache.camel.Exchange exchange, org.asynchttpclient.HttpResponseStatus responseStatus) throws Exception
Description copied from interface:AhcBinding
Callback from thecom.ning.http.client.AsyncHttpClient
when the HTTP response status was received- Specified by:
onStatusReceived
in interfaceAhcBinding
- Parameters:
endpoint
- the endpointexchange
- the exchangeresponseStatus
- 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, io.netty.handler.codec.http.HttpHeaders headers) throws Exception
Description copied from interface:AhcBinding
Callback from thecom.ning.http.client.AsyncHttpClient
when the HTTP headers was received- Specified by:
onHeadersReceived
in interfaceAhcBinding
- Parameters:
endpoint
- the endpointexchange
- the exchangeheaders
- 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 thecom.ning.http.client.AsyncHttpClient
when complete and all the response has been received.- Specified by:
onComplete
in interfaceAhcBinding
- Parameters:
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 text- Throws:
Exception
- is thrown if error occurred in the callback
-
-