public class HttpSupport extends Object
| Modifier and Type | Field | Description |
|---|---|---|
static String |
ENCODING_GZIP |
The
gzip encoding value for HDR_ACCEPT_ENCODING. |
static String |
HDR_ACCEPT |
The
Accept header. |
static String |
HDR_ACCEPT_ENCODING |
The
Accept-Encoding header. |
static String |
HDR_ACCEPT_RANGES |
The
Accept-Ranges header. |
static String |
HDR_AUTHORIZATION |
The
Authorization header. |
static String |
HDR_CACHE_CONTROL |
The
Cache-Control header. |
static String |
HDR_CONTENT_ENCODING |
The
Content-Encoding header. |
static String |
HDR_CONTENT_LENGTH |
The
Content-Length header. |
static String |
HDR_CONTENT_RANGE |
The
Content-Range header. |
static String |
HDR_CONTENT_TYPE |
The
Content-Type header. |
static String |
HDR_DATE |
The
Date header. |
static String |
HDR_ETAG |
The
ETag header. |
static String |
HDR_EXPIRES |
The
Expires header. |
static String |
HDR_IF_MODIFIED_SINCE |
The
If-Modified-Since header. |
static String |
HDR_IF_NONE_MATCH |
The
If-None-Match header. |
static String |
HDR_IF_RANGE |
The
If-Range header. |
static String |
HDR_LAST_MODIFIED |
The
Last-Modified header. |
static String |
HDR_PRAGMA |
The
Pragma header. |
static String |
HDR_RANGE |
The
Range header. |
static String |
HDR_USER_AGENT |
The
User-Agent header. |
static String |
HDR_WWW_AUTHENTICATE |
The
WWW-Authenticate header. |
static String |
METHOD_GET |
The
GET HTTP method. |
static String |
METHOD_POST |
The
POST HTTP method. |
static String |
TEXT_PLAIN |
The standard
text/plain MIME type. |
| Modifier and Type | Method | Description |
|---|---|---|
static void |
encode(StringBuilder urlstr,
String key) |
URL encode a value string into an output buffer.
|
static Proxy |
proxyFor(ProxySelector proxySelector,
URL u) |
Determine the proxy server (if any) needed to obtain a URL.
|
static int |
response(HttpURLConnection c) |
Get the HTTP response code from the request.
|
static int |
response(HttpConnection c) |
Get the HTTP response code from the request.
|
public static final String METHOD_GET
GET HTTP method.public static final String METHOD_POST
POST HTTP method.public static final String HDR_CACHE_CONTROL
Cache-Control header.public static final String HDR_PRAGMA
Pragma header.public static final String HDR_USER_AGENT
User-Agent header.public static final String HDR_DATE
Date header.public static final String HDR_EXPIRES
Expires header.public static final String HDR_ETAG
ETag header.public static final String HDR_IF_NONE_MATCH
If-None-Match header.public static final String HDR_LAST_MODIFIED
Last-Modified header.public static final String HDR_IF_MODIFIED_SINCE
If-Modified-Since header.public static final String HDR_ACCEPT
Accept header.public static final String HDR_CONTENT_TYPE
Content-Type header.public static final String HDR_CONTENT_LENGTH
Content-Length header.public static final String HDR_CONTENT_ENCODING
Content-Encoding header.public static final String HDR_CONTENT_RANGE
Content-Range header.public static final String HDR_ACCEPT_RANGES
Accept-Ranges header.public static final String HDR_IF_RANGE
If-Range header.public static final String HDR_RANGE
Range header.public static final String HDR_ACCEPT_ENCODING
Accept-Encoding header.public static final String ENCODING_GZIP
gzip encoding value for HDR_ACCEPT_ENCODING.public static final String TEXT_PLAIN
text/plain MIME type.public static final String HDR_AUTHORIZATION
Authorization header.public static final String HDR_WWW_AUTHENTICATE
WWW-Authenticate header.public static void encode(StringBuilder urlstr, String key)
urlstr - the output buffer.key - value which must be encoded to protected special characters.public static int response(HttpConnection c) throws IOException
Roughly the same as c.getResponseCode() but the
ConnectException is translated to be more understandable.
c - connection the code should be obtained from.HttpConnection for other defined constants.IOException - communications error prevented obtaining the response code.public static int response(HttpURLConnection c) throws IOException
Roughly the same as c.getResponseCode() but the
ConnectException is translated to be more understandable.
c - connection the code should be obtained from.HttpConnection for other defined constants.IOException - communications error prevented obtaining the response code.public static Proxy proxyFor(ProxySelector proxySelector, URL u) throws ConnectException
proxySelector - proxy support for the caller.u - location of the server caller wants to talk to.ConnectException - the proxy could not be computed as the supplied URL could not
be read. This failure should never occur.Copyright © 2018. All rights reserved.