public class ApacheUtils extends Object
Constructor and Description |
---|
ApacheUtils() |
Modifier and Type | Method and Description |
---|---|
static HttpResponse |
createResponse(Request<?> request,
org.apache.http.client.methods.HttpRequestBase method,
org.apache.http.HttpResponse apacheHttpResponse,
org.apache.http.protocol.HttpContext context)
Creates and initializes an HttpResponse object suitable to be passed to an HTTP response
handler object.
|
static boolean |
isRequestSuccessful(org.apache.http.HttpResponse response)
Checks if the request was successful or not based on the status code.
|
static org.apache.http.HttpEntity |
newBufferedHttpEntity(org.apache.http.HttpEntity entity)
Utility function for creating a new BufferedEntity and wrapping any errors
as a SdkClientException.
|
static org.apache.http.client.protocol.HttpClientContext |
newClientContext(HttpClientSettings settings,
Map<String,? extends Object> attributes)
Returns a new HttpClientContext used for request execution.
|
static org.apache.http.client.CredentialsProvider |
newProxyCredentialsProvider(HttpClientSettings settings)
Returns a new Credentials Provider for use with proxy authentication.
|
static org.apache.http.HttpEntity |
newStringEntity(String s)
Utility function for creating a new StringEntity and wrapping any errors
as a SdkClientException.
|
public static boolean isRequestSuccessful(org.apache.http.HttpResponse response)
response
- HTTP responsepublic static HttpResponse createResponse(Request<?> request, org.apache.http.client.methods.HttpRequestBase method, org.apache.http.HttpResponse apacheHttpResponse, org.apache.http.protocol.HttpContext context) throws IOException
request
- Marshalled request object.method
- The HTTP method that was invoked to get the response.context
- The HTTP context associated with the request and response.IOException
- If there were any problems getting any response information from the
HttpClient method object.public static org.apache.http.HttpEntity newStringEntity(String s)
s
- The string contents of the returned HTTP entity.public static org.apache.http.HttpEntity newBufferedHttpEntity(org.apache.http.HttpEntity entity) throws FakeIOException
entity
- The HTTP entity to wrap with a buffered HTTP entity.FakeIOException
- only for test simulationpublic static org.apache.http.client.protocol.HttpClientContext newClientContext(HttpClientSettings settings, Map<String,? extends Object> attributes)
public static org.apache.http.client.CredentialsProvider newProxyCredentialsProvider(HttpClientSettings settings)
Copyright © 2018. All rights reserved.