public class HttpUtil extends Object
Modifier and Type | Field and Description |
---|---|
private static SimpleDateFormat |
HTTP_DATE_FORMAT |
Constructor and Description |
---|
HttpUtil() |
Modifier and Type | Method and Description |
---|---|
static long |
getContentLength(org.apache.http.HttpResponse response)
Get the content length from the headers in the response.
|
static String |
getContentType(org.apache.http.HttpResponse response)
Get the content type of the content from the headers
in the response.
|
static Date |
getDate(org.apache.http.HttpResponse response,
String header,
Date defaultValue) |
static Date |
getLastModified(org.apache.http.HttpResponse response)
Get the date the content was last modified from the headers
in the response.
|
static Long |
getLong(org.apache.http.HttpResponse response,
String header,
Long defaultValue) |
static String |
getString(org.apache.http.HttpResponse response,
String header,
String defaultValue) |
static void |
shutdown(org.apache.http.impl.client.CloseableHttpClient client)
Safely shuts down a http client and it's connection manager
without trowing an exception.
|
static void |
shutdown(org.apache.http.client.HttpClient client)
Deprecated.
In 3.4, use
shutdown(CloseableHttpClient) instead |
private static final SimpleDateFormat HTTP_DATE_FORMAT
public static long getContentLength(org.apache.http.HttpResponse response)
response
- The response from a HTTP requestpublic static Date getLastModified(org.apache.http.HttpResponse response)
response
- The response from a HTTP requestpublic static String getContentType(org.apache.http.HttpResponse response)
response
- The response from a HTTP requestpublic static String getString(org.apache.http.HttpResponse response, String header, String defaultValue)
public static Long getLong(org.apache.http.HttpResponse response, String header, Long defaultValue)
public static Date getDate(org.apache.http.HttpResponse response, String header, Date defaultValue)
@Deprecated public static void shutdown(org.apache.http.client.HttpClient client)
shutdown(CloseableHttpClient)
insteadpublic static void shutdown(org.apache.http.impl.client.CloseableHttpClient client)