Class TracedHttpClient

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.apache.http.client.HttpClient

    public class TracedHttpClient
    extends org.apache.http.impl.client.CloseableHttpClient
    • Constructor Summary

      Constructors 
      Constructor Description
      TracedHttpClient​(org.apache.http.impl.client.CloseableHttpClient wrappedClient)
      Constructs a TracedHttpClient instance using the provided client and global recorder.
      TracedHttpClient​(org.apache.http.impl.client.CloseableHttpClient wrappedClient, AWSXRayRecorder recorder)
      Constructs a TracedHttpClient instance using the provided client and provided recorder.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void addRequestInformation​(Subsegment subsegment, org.apache.http.HttpRequest request, java.lang.String url)  
      void close()  
      static org.apache.http.HttpHost determineTarget​(org.apache.http.client.methods.HttpUriRequest request)  
      protected org.apache.http.client.methods.CloseableHttpResponse doExecute​(org.apache.http.HttpHost httpHost, org.apache.http.HttpRequest httpRequest, org.apache.http.protocol.HttpContext httpContext)  
      org.apache.http.client.methods.CloseableHttpResponse execute​(org.apache.http.client.methods.HttpUriRequest request)  
      <T> T execute​(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.client.ResponseHandler<? extends T> responseHandler)  
      <T> T execute​(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.client.ResponseHandler<? extends T> responseHandler, org.apache.http.protocol.HttpContext context)  
      org.apache.http.client.methods.CloseableHttpResponse execute​(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.protocol.HttpContext context)  
      org.apache.http.client.methods.CloseableHttpResponse execute​(org.apache.http.HttpHost target, org.apache.http.HttpRequest request)  
      <T> T execute​(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.client.ResponseHandler<? extends T> responseHandler)  
      <T> T execute​(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.client.ResponseHandler<? extends T> responseHandler, org.apache.http.protocol.HttpContext context)  
      org.apache.http.client.methods.CloseableHttpResponse execute​(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context)  
      org.apache.http.conn.ClientConnectionManager getConnectionManager()  
      org.apache.http.params.HttpParams getParams()  
      static java.lang.String getUrl​(org.apache.http.client.methods.HttpUriRequest request)  
      static java.lang.String getUrl​(org.apache.http.HttpHost target, org.apache.http.HttpRequest request)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TracedHttpClient

        public TracedHttpClient​(org.apache.http.impl.client.CloseableHttpClient wrappedClient)
        Constructs a TracedHttpClient instance using the provided client and global recorder.
        Parameters:
        wrappedClient - the HTTP client to wrap
      • TracedHttpClient

        public TracedHttpClient​(org.apache.http.impl.client.CloseableHttpClient wrappedClient,
                                AWSXRayRecorder recorder)
        Constructs a TracedHttpClient instance using the provided client and provided recorder.
        Parameters:
        wrappedClient - the HTTP client to wrap
        recorder - the recorder instance to use when generating subsegments around calls made by wrappedClient
    • Method Detail

      • determineTarget

        public static org.apache.http.HttpHost determineTarget​(org.apache.http.client.methods.HttpUriRequest request)
                                                        throws org.apache.http.client.ClientProtocolException
        Throws:
        org.apache.http.client.ClientProtocolException
      • getUrl

        public static java.lang.String getUrl​(org.apache.http.client.methods.HttpUriRequest request)
      • getUrl

        public static java.lang.String getUrl​(org.apache.http.HttpHost target,
                                              org.apache.http.HttpRequest request)
      • addRequestInformation

        public static void addRequestInformation​(Subsegment subsegment,
                                                 org.apache.http.HttpRequest request,
                                                 java.lang.String url)
      • execute

        public org.apache.http.client.methods.CloseableHttpResponse execute​(org.apache.http.HttpHost target,
                                                                            org.apache.http.HttpRequest request,
                                                                            org.apache.http.protocol.HttpContext context)
                                                                     throws java.io.IOException,
                                                                            org.apache.http.client.ClientProtocolException
        Specified by:
        execute in interface org.apache.http.client.HttpClient
        Overrides:
        execute in class org.apache.http.impl.client.CloseableHttpClient
        Throws:
        java.io.IOException
        org.apache.http.client.ClientProtocolException
      • execute

        public org.apache.http.client.methods.CloseableHttpResponse execute​(org.apache.http.client.methods.HttpUriRequest request,
                                                                            org.apache.http.protocol.HttpContext context)
                                                                     throws java.io.IOException,
                                                                            org.apache.http.client.ClientProtocolException
        Specified by:
        execute in interface org.apache.http.client.HttpClient
        Overrides:
        execute in class org.apache.http.impl.client.CloseableHttpClient
        Throws:
        java.io.IOException
        org.apache.http.client.ClientProtocolException
      • execute

        public org.apache.http.client.methods.CloseableHttpResponse execute​(org.apache.http.client.methods.HttpUriRequest request)
                                                                     throws java.io.IOException,
                                                                            org.apache.http.client.ClientProtocolException
        Specified by:
        execute in interface org.apache.http.client.HttpClient
        Overrides:
        execute in class org.apache.http.impl.client.CloseableHttpClient
        Throws:
        java.io.IOException
        org.apache.http.client.ClientProtocolException
      • execute

        public org.apache.http.client.methods.CloseableHttpResponse execute​(org.apache.http.HttpHost target,
                                                                            org.apache.http.HttpRequest request)
                                                                     throws java.io.IOException,
                                                                            org.apache.http.client.ClientProtocolException
        Specified by:
        execute in interface org.apache.http.client.HttpClient
        Overrides:
        execute in class org.apache.http.impl.client.CloseableHttpClient
        Throws:
        java.io.IOException
        org.apache.http.client.ClientProtocolException
      • execute

        public <T> T execute​(org.apache.http.client.methods.HttpUriRequest request,
                             org.apache.http.client.ResponseHandler<? extends T> responseHandler)
                      throws java.io.IOException,
                             org.apache.http.client.ClientProtocolException
        Specified by:
        execute in interface org.apache.http.client.HttpClient
        Overrides:
        execute in class org.apache.http.impl.client.CloseableHttpClient
        Throws:
        java.io.IOException
        org.apache.http.client.ClientProtocolException
      • execute

        public <T> T execute​(org.apache.http.client.methods.HttpUriRequest request,
                             org.apache.http.client.ResponseHandler<? extends T> responseHandler,
                             org.apache.http.protocol.HttpContext context)
                      throws java.io.IOException,
                             org.apache.http.client.ClientProtocolException
        Specified by:
        execute in interface org.apache.http.client.HttpClient
        Overrides:
        execute in class org.apache.http.impl.client.CloseableHttpClient
        Throws:
        java.io.IOException
        org.apache.http.client.ClientProtocolException
      • execute

        public <T> T execute​(org.apache.http.HttpHost target,
                             org.apache.http.HttpRequest request,
                             org.apache.http.client.ResponseHandler<? extends T> responseHandler)
                      throws java.io.IOException,
                             org.apache.http.client.ClientProtocolException
        Specified by:
        execute in interface org.apache.http.client.HttpClient
        Overrides:
        execute in class org.apache.http.impl.client.CloseableHttpClient
        Throws:
        java.io.IOException
        org.apache.http.client.ClientProtocolException
      • execute

        public <T> T execute​(org.apache.http.HttpHost target,
                             org.apache.http.HttpRequest request,
                             org.apache.http.client.ResponseHandler<? extends T> responseHandler,
                             org.apache.http.protocol.HttpContext context)
                      throws java.io.IOException,
                             org.apache.http.client.ClientProtocolException
        Specified by:
        execute in interface org.apache.http.client.HttpClient
        Overrides:
        execute in class org.apache.http.impl.client.CloseableHttpClient
        Throws:
        java.io.IOException
        org.apache.http.client.ClientProtocolException
      • getConnectionManager

        public org.apache.http.conn.ClientConnectionManager getConnectionManager()
      • getParams

        public org.apache.http.params.HttpParams getParams()
      • close

        public void close()
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • doExecute

        protected org.apache.http.client.methods.CloseableHttpResponse doExecute​(org.apache.http.HttpHost httpHost,
                                                                                 org.apache.http.HttpRequest httpRequest,
                                                                                 org.apache.http.protocol.HttpContext httpContext)
                                                                          throws java.io.IOException,
                                                                                 org.apache.http.client.ClientProtocolException
        Specified by:
        doExecute in class org.apache.http.impl.client.CloseableHttpClient
        Throws:
        java.io.IOException
        org.apache.http.client.ClientProtocolException