@Singleton public class HttpUtils extends Object
Constructor and Description |
---|
HttpUtils(int connectionTimeout,
int soTimeout,
int globalMaxConnections,
int globalMaxConnectionsPerHost) |
Modifier and Type | Method and Description |
---|---|
static Long |
attemptToParseSizeAndRangeFromHeaders(HttpMessage from) |
static void |
checkRequestHasContentLengthOrChunkedEncoding(HttpMessage request,
String message) |
void |
checkRequestHasRequiredProperties(HttpRequest message) |
static byte[] |
closeClientButKeepContentStream(PayloadEnclosing response)
Content stream may need to be read.
|
static boolean |
contains404(Throwable t) |
static void |
copy(ContentMetadata fromMd,
MutableContentMetadata toMd) |
static com.google.common.collect.Multimap<String,String> |
filterOutContentHeaders(com.google.common.collect.Multimap<String,String> headers) |
int |
getConnectionTimeout() |
int |
getMaxConnections() |
int |
getMaxConnectionsPerHost() |
int |
getSocketOpenTimeout() |
void |
logRequest(Logger logger,
HttpRequest request,
String prefix) |
void |
logResponse(Logger logger,
HttpResponse response,
String prefix) |
static String |
nullToEmpty(byte[] md5) |
static String |
nullToEmpty(Collection<String> collection) |
boolean |
relaxHostname() |
static void |
releasePayload(HttpMessage from) |
static <T> T |
returnValueOnCodeOrNull(Throwable from,
T value,
com.google.common.base.Predicate<Integer> codePredicate) |
static byte[] |
toByteArrayOrNull(PayloadEnclosing response) |
boolean |
trustAllCerts() |
static com.google.common.base.Optional<String> |
tryFindHttpMethod(com.google.common.reflect.Invokable<?,?> method) |
static void |
wirePayloadIfEnabled(Wire wire,
HttpMessage request) |
@Inject public HttpUtils(@Named(value="jclouds.connection-timeout") int connectionTimeout, @Named(value="jclouds.so-timeout") int soTimeout, @Named(value="jclouds.max-connections-per-context") int globalMaxConnections, @Named(value="jclouds.max-connections-per-host") int globalMaxConnectionsPerHost)
public int getSocketOpenTimeout()
public int getConnectionTimeout()
public boolean relaxHostname()
public boolean trustAllCerts()
public int getMaxConnections()
public int getMaxConnectionsPerHost()
public static byte[] toByteArrayOrNull(PayloadEnclosing response)
public static com.google.common.base.Optional<String> tryFindHttpMethod(com.google.common.reflect.Invokable<?,?> method)
public static byte[] closeClientButKeepContentStream(PayloadEnclosing response)
IOException
public static void copy(ContentMetadata fromMd, MutableContentMetadata toMd)
public void logRequest(Logger logger, HttpRequest request, String prefix)
public void logResponse(Logger logger, HttpResponse response, String prefix)
public void checkRequestHasRequiredProperties(HttpRequest message)
public static void releasePayload(HttpMessage from)
public static String nullToEmpty(byte[] md5)
public static String nullToEmpty(Collection<String> collection)
public static Long attemptToParseSizeAndRangeFromHeaders(HttpMessage from) throws HttpException
HttpException
public static void checkRequestHasContentLengthOrChunkedEncoding(HttpMessage request, String message)
public static void wirePayloadIfEnabled(Wire wire, HttpMessage request)
public static <T> T returnValueOnCodeOrNull(Throwable from, T value, com.google.common.base.Predicate<Integer> codePredicate)
public static com.google.common.collect.Multimap<String,String> filterOutContentHeaders(com.google.common.collect.Multimap<String,String> headers)
public static boolean contains404(Throwable t)
Copyright © 2009-2013 jclouds. All Rights Reserved.