Class TracedHttpClient

java.lang.Object
org.apache.http.impl.client.CloseableHttpClient
com.amazonaws.xray.proxies.apache.http.TracedHttpClient
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.http.client.HttpClient

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

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
     
  • 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

    Modifier and Type
    Method
    Description
    static void
    addRequestInformation(Subsegment subsegment, org.apache.http.HttpRequest request, String url)
     
    void
     
    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
     
    org.apache.http.params.HttpParams
     
    static String
    getUrl(org.apache.http.client.methods.HttpUriRequest request)
     
    static 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 Details

    • 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 Details

    • 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 String getUrl(org.apache.http.client.methods.HttpUriRequest request)
    • getUrl

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

      public static void addRequestInformation(Subsegment subsegment, org.apache.http.HttpRequest request, 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 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:
      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 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:
      IOException
      org.apache.http.client.ClientProtocolException
    • execute

      public org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.client.methods.HttpUriRequest request) throws 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:
      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 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:
      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 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:
      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 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:
      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 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:
      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 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:
      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 IOException
      Throws:
      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 IOException, org.apache.http.client.ClientProtocolException
      Specified by:
      doExecute in class org.apache.http.impl.client.CloseableHttpClient
      Throws:
      IOException
      org.apache.http.client.ClientProtocolException