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 -
Constructor Summary
ConstructorsConstructorDescriptionTracedHttpClient
(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 TypeMethodDescriptionstatic void
addRequestInformation
(Subsegment subsegment, org.apache.http.HttpRequest request, 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
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)
-
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 wraprecorder
- the recorder instance to use when generating subsegments around calls made bywrappedClient
-
-
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
-
getUrl
-
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 interfaceorg.apache.http.client.HttpClient
- Overrides:
execute
in classorg.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 interfaceorg.apache.http.client.HttpClient
- Overrides:
execute
in classorg.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 interfaceorg.apache.http.client.HttpClient
- Overrides:
execute
in classorg.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 interfaceorg.apache.http.client.HttpClient
- Overrides:
execute
in classorg.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 interfaceorg.apache.http.client.HttpClient
- Overrides:
execute
in classorg.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 interfaceorg.apache.http.client.HttpClient
- Overrides:
execute
in classorg.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 interfaceorg.apache.http.client.HttpClient
- Overrides:
execute
in classorg.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 interfaceorg.apache.http.client.HttpClient
- Overrides:
execute
in classorg.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
- 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 classorg.apache.http.impl.client.CloseableHttpClient
- Throws:
IOException
org.apache.http.client.ClientProtocolException
-