Interface AhcBinding

  • All Known Implementing Classes:
    DefaultAhcBinding

    public interface AhcBinding
    Binding from Camel to/from com.ning.http.client.AsyncHttpClient
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      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.
      org.asynchttpclient.Request prepareRequest​(AhcEndpoint endpoint, org.apache.camel.Exchange exchange)
      Prepares the AHC Request to be send.
    • Method Detail

      • prepareRequest

        org.asynchttpclient.Request prepareRequest​(AhcEndpoint endpoint,
                                                   org.apache.camel.Exchange exchange)
                                            throws Exception
        Prepares the AHC Request to be send.
        Parameters:
        endpoint - the endpoint
        exchange - the exchange
        Returns:
        the request to send using the com.ning.http.client.AsyncHttpClient
        Throws:
        Exception - is thrown if error occurred preparing the request
      • onThrowable

        void onThrowable​(AhcEndpoint endpoint,
                         org.apache.camel.Exchange exchange,
                         Throwable t)
                  throws Exception
        Callback from the com.ning.http.client.AsyncHttpClient when an exception occurred sending the request.
        Parameters:
        endpoint - the endpoint
        exchange - the exchange
        t - the thrown exception
        Throws:
        Exception - is thrown if error occurred in the callback
      • onStatusReceived

        void onStatusReceived​(AhcEndpoint endpoint,
                              org.apache.camel.Exchange exchange,
                              org.asynchttpclient.HttpResponseStatus responseStatus)
                       throws Exception
        Callback from the com.ning.http.client.AsyncHttpClient when the HTTP response status was received
        Parameters:
        endpoint - the endpoint
        exchange - the exchange
        responseStatus - the HTTP response status
        Throws:
        Exception - is thrown if error occurred in the callback
      • onHeadersReceived

        void onHeadersReceived​(AhcEndpoint endpoint,
                               org.apache.camel.Exchange exchange,
                               io.netty.handler.codec.http.HttpHeaders headers)
                        throws Exception
        Callback from the com.ning.http.client.AsyncHttpClient when the HTTP headers was received
        Parameters:
        endpoint - the endpoint
        exchange - the exchange
        headers - the HTTP headers
        Throws:
        Exception - is thrown if error occurred in the callback
      • onComplete

        void onComplete​(AhcEndpoint endpoint,
                        org.apache.camel.Exchange exchange,
                        String url,
                        ByteArrayOutputStream os,
                        int contentLength,
                        int statusCode,
                        String statusText)
                 throws Exception
        Callback from the com.ning.http.client.AsyncHttpClient when complete and all the response has been received.
        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