Class DefaultAhcBinding

    • Field Detail

      • log

        protected final org.slf4j.Logger log
      • httpProtocolHeaderFilterStrategy

        protected org.apache.camel.spi.HeaderFilterStrategy httpProtocolHeaderFilterStrategy
    • Constructor Detail

      • DefaultAhcBinding

        public DefaultAhcBinding()
    • 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 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 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 the com.ning.http.client.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,
                                     org.asynchttpclient.HttpResponseStatus responseStatus)
                              throws Exception
        Description copied from interface: AhcBinding
        Callback from the com.ning.http.client.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,
                                      io.netty.handler.codec.http.HttpHeaders headers)
                               throws Exception
        Description copied from interface: AhcBinding
        Callback from the com.ning.http.client.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 com.ning.http.client.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