Class TracedHttpClient
- java.lang.Object
-
- org.apache.http.impl.client.CloseableHttpClient
-
- com.amazonaws.xray.proxies.apache.http.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceTracedHttpClient.HttpSupplier<R>
-
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 voidaddRequestInformation(Subsegment subsegment, org.apache.http.HttpRequest request, java.lang.String url)voidclose()static org.apache.http.HttpHostdetermineTarget(org.apache.http.client.methods.HttpUriRequest request)protected org.apache.http.client.methods.CloseableHttpResponsedoExecute(org.apache.http.HttpHost httpHost, org.apache.http.HttpRequest httpRequest, org.apache.http.protocol.HttpContext httpContext)org.apache.http.client.methods.CloseableHttpResponseexecute(org.apache.http.client.methods.HttpUriRequest request)<T> Texecute(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.client.ResponseHandler<? extends T> responseHandler)<T> Texecute(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.CloseableHttpResponseexecute(org.apache.http.client.methods.HttpUriRequest request, org.apache.http.protocol.HttpContext context)org.apache.http.client.methods.CloseableHttpResponseexecute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request)<T> Texecute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.client.ResponseHandler<? extends T> responseHandler)<T> Texecute(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.CloseableHttpResponseexecute(org.apache.http.HttpHost target, org.apache.http.HttpRequest request, org.apache.http.protocol.HttpContext context)org.apache.http.conn.ClientConnectionManagergetConnectionManager()org.apache.http.params.HttpParamsgetParams()static java.lang.StringgetUrl(org.apache.http.client.methods.HttpUriRequest request)static java.lang.StringgetUrl(org.apache.http.HttpHost target, org.apache.http.HttpRequest request)
-
-
-
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 wraprecorder- the recorder instance to use when generating subsegments around calls made bywrappedClient
-
-
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:
executein interfaceorg.apache.http.client.HttpClient- Overrides:
executein classorg.apache.http.impl.client.CloseableHttpClient- Throws:
java.io.IOExceptionorg.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:
executein interfaceorg.apache.http.client.HttpClient- Overrides:
executein classorg.apache.http.impl.client.CloseableHttpClient- Throws:
java.io.IOExceptionorg.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:
executein interfaceorg.apache.http.client.HttpClient- Overrides:
executein classorg.apache.http.impl.client.CloseableHttpClient- Throws:
java.io.IOExceptionorg.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:
executein interfaceorg.apache.http.client.HttpClient- Overrides:
executein classorg.apache.http.impl.client.CloseableHttpClient- Throws:
java.io.IOExceptionorg.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:
executein interfaceorg.apache.http.client.HttpClient- Overrides:
executein classorg.apache.http.impl.client.CloseableHttpClient- Throws:
java.io.IOExceptionorg.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:
executein interfaceorg.apache.http.client.HttpClient- Overrides:
executein classorg.apache.http.impl.client.CloseableHttpClient- Throws:
java.io.IOExceptionorg.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:
executein interfaceorg.apache.http.client.HttpClient- Overrides:
executein classorg.apache.http.impl.client.CloseableHttpClient- Throws:
java.io.IOExceptionorg.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:
executein interfaceorg.apache.http.client.HttpClient- Overrides:
executein classorg.apache.http.impl.client.CloseableHttpClient- Throws:
java.io.IOExceptionorg.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:
doExecutein classorg.apache.http.impl.client.CloseableHttpClient- Throws:
java.io.IOExceptionorg.apache.http.client.ClientProtocolException
-
-