//shared/org.readium.r2.shared.util.http/DefaultHttpClient
DefaultHttpClient¶
[androidJvm]\ class DefaultHttpClient(userAgent: String?, additionalHeaders: Map<String, String>, connectTimeout: Duration?, readTimeout: Duration?, callback: DefaultHttpClient.Callback?) : HttpClient
An implementation of HttpClient using the native HttpURLConnection.
Parameters¶
androidJvm
| userAgent | Custom user agent to use for requests. |
| additionalHeaders | A dictionary of additional headers to send with requests. |
| connectTimeout | Timeout used when establishing a connection to the resource. A null timeout is interpreted as the default value, while a timeout of zero as an infinite timeout. |
| readTimeout | Timeout used when reading the input stream. A null timeout is interpreted as the default value, while a timeout of zero as an infinite timeout. |
Constructors¶
| DefaultHttpClient | [androidJvm] fun DefaultHttpClient(userAgent: String? = null, additionalHeaders: Map<String, String> = mapOf(), connectTimeout: Duration? = null, readTimeout: Duration? = null, callback: DefaultHttpClient.Callback? = null) |
Types¶
| Name | Summary |
|---|---|
| Callback | [androidJvm] interface Callback Callbacks allowing to override some behavior of the DefaultHttpClient. |
Functions¶
| Name | Summary |
|---|---|
| fetch | [androidJvm] open suspend fun fetch(request: HttpRequest): HttpTry<HttpFetchResponse> Fetches the resource from the given request. |
| stream | [androidJvm] open suspend override fun stream(request: HttpRequest): HttpTry<HttpStreamResponse> Streams the resource from the given request. |
Properties¶
| Name | Summary |
|---|---|
| callback | [androidJvm] var callback: DefaultHttpClient.Callback? = null |