public class HttpRequestHttpURLConnectionAdapter extends java.lang.Object implements HttpRequest
HttpRequest and forwarding calls to HttpURLConnection adaptee.| Constructor and Description |
|---|
HttpRequestHttpURLConnectionAdapter(java.net.HttpURLConnection httpURLConnection)
Initializes a new instance of
HttpRequestHttpURLConnectionAdapter |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getHeader(java.lang.String name)
Gets the header's value.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getHeaders()
Gets an immutable map containing the request headers and their values.
|
java.lang.String |
getMethod()
Gets the HTTP request method.
|
java.net.URL |
getUrl()
Gets the HTTP request
URL. |
void |
setHeader(java.lang.String name,
java.lang.String value)
Sets an HTTP header or overwrites an existing HTTP header with new value.
|
public HttpRequestHttpURLConnectionAdapter(java.net.HttpURLConnection httpURLConnection)
HttpRequestHttpURLConnectionAdapterhttpURLConnection - underlying HttpURLConnectionpublic java.net.URL getUrl()
HttpRequestURL.getUrl in interface HttpRequestpublic java.lang.String getMethod()
HttpRequestgetMethod in interface HttpRequestpublic java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()
HttpRequestgetHeaders in interface HttpRequestpublic java.lang.String getHeader(java.lang.String name)
HttpRequestgetHeader in interface HttpRequestname - Header name for which to retrieve the value.null if not set.public void setHeader(java.lang.String name,
java.lang.String value)
HttpRequestTrying to set an HTTP header with null name will return immediately. Trying to set one of the following restricted headers will also return immediately.
Access-Control-Request-HeadersAccess-Control-Request-MethodConnectionContent-LengthContent-Transfer-EncodingHostKeep-AliveOriginTrailerTransfer-EncodingUpgradeViasetHeader in interface HttpRequestname - The header's name, which must not be null or any of the restricted headers.value - The header's value