HttpUtil
@UnstableApi
class HttpUtil
Utility methods for HTTP.
Summary
Public functions |
|
|---|---|
java-static String? |
buildRangeRequestHeader(position: Long, length: Long)Builds a |
java-static Long |
getContentLength(contentLengthHeader: String?, contentRangeHeader: String?)Attempts to parse the length of a response body from the corresponding response headers. |
java-static String! |
getCookieHeader(Returns the stored cookie header for the given response URL and headers. |
java-static Long |
getDocumentSize(contentRangeHeader: String?)Attempts to parse the document size from a |
java-static Unit |
storeCookiesFromHeaders(Stores the cookie headers from the response in the provided |
Public functions
buildRangeRequestHeader
java-static fun buildRangeRequestHeader(position: Long, length: Long): String?
Builds a Range header for the given position and length.
| Parameters | |
|---|---|
position: Long |
The request position. |
length: Long |
The request length, or |
| Returns | |
|---|---|
String? |
The corresponding range header, or |
getContentLength
java-static fun getContentLength(contentLengthHeader: String?, contentRangeHeader: String?): Long
Attempts to parse the length of a response body from the corresponding response headers.
| Parameters | |
|---|---|
contentLengthHeader: String? |
The |
contentRangeHeader: String? |
The |
| Returns | |
|---|---|
Long |
The length of the response body, or |
getCookieHeader
java-static fun getCookieHeader(
url: String!,
headers: (Mutable)Map<String!, (Mutable)List<String!>!>!,
cookieHandler: CookieHandler?
): String!
Returns the stored cookie header for the given response URL and headers.
| Parameters | |
|---|---|
url: String! |
The URL of the response. |
headers: (Mutable)Map<String!, (Mutable)List<String!>!>! |
The headers of the response. |
cookieHandler: CookieHandler? |
The |
getDocumentSize
java-static fun getDocumentSize(contentRangeHeader: String?): Long
Attempts to parse the document size from a Content-Range header.
| Parameters | |
|---|---|
contentRangeHeader: String? |
The |
| Returns | |
|---|---|
Long |
The document size, or |
storeCookiesFromHeaders
java-static fun storeCookiesFromHeaders(
url: String!,
headers: (Mutable)Map<String!, (Mutable)List<String!>!>!,
cookieHandler: CookieHandler?
): Unit
Stores the cookie headers from the response in the provided CookieHandler.
| Parameters | |
|---|---|
url: String! |
The URL of the response. |
headers: (Mutable)Map<String!, (Mutable)List<String!>!>! |
The headers of the response. |
cookieHandler: CookieHandler? |
The |