Class HttpRequestHttpURLConnectionAdapter
- java.lang.Object
-
- com.dynatrace.openkit.protocol.http.HttpRequestHttpURLConnectionAdapter
-
- All Implemented Interfaces:
HttpRequest
public class HttpRequestHttpURLConnectionAdapter extends java.lang.Object implements HttpRequest
Class implementing theHttpRequestand forwarding calls toHttpURLConnectionadaptee.
-
-
Constructor Summary
Constructors Constructor Description HttpRequestHttpURLConnectionAdapter(java.net.HttpURLConnection httpURLConnection)Initializes a new instance ofHttpRequestHttpURLConnectionAdapter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetHeader(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.StringgetMethod()Gets the HTTP request method.java.net.URLgetUrl()Gets the HTTP requestURL.voidsetHeader(java.lang.String name, java.lang.String value)Sets an HTTP header or overwrites an existing HTTP header with new value.
-
-
-
Constructor Detail
-
HttpRequestHttpURLConnectionAdapter
public HttpRequestHttpURLConnectionAdapter(java.net.HttpURLConnection httpURLConnection)
Initializes a new instance ofHttpRequestHttpURLConnectionAdapter- Parameters:
httpURLConnection- underlyingHttpURLConnection
-
-
Method Detail
-
getUrl
public java.net.URL getUrl()
Description copied from interface:HttpRequestGets the HTTP requestURL.- Specified by:
getUrlin interfaceHttpRequest
-
getMethod
public java.lang.String getMethod()
Description copied from interface:HttpRequestGets the HTTP request method.- Specified by:
getMethodin interfaceHttpRequest
-
getHeaders
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()
Description copied from interface:HttpRequestGets an immutable map containing the request headers and their values.- Specified by:
getHeadersin interfaceHttpRequest
-
getHeader
public java.lang.String getHeader(java.lang.String name)
Description copied from interface:HttpRequestGets the header's value.- Specified by:
getHeaderin interfaceHttpRequest- Parameters:
name- Header name for which to retrieve the value.- Returns:
- The header's value, which might also be
nullif not set.
-
setHeader
public void setHeader(java.lang.String name, java.lang.String value)Description copied from interface:HttpRequestSets an HTTP header or overwrites an existing HTTP header with new value.Trying 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-EncodingUpgradeVia
- Specified by:
setHeaderin interfaceHttpRequest- Parameters:
name- The header's name, which must not benullor any of the restricted headers.value- The header's value
-
-