Skip to content

//readium-shared/org.readium.r2.shared.util.http

Package-level declarations

Types

Name Summary
DefaultHttpClient [androidJvm]
class DefaultHttpClient(userAgent: String? = null, additionalHeaders: Map<String, String> = mapOf(), connectTimeout: Duration? = null, readTimeout: Duration? = null, var callback: DefaultHttpClient.Callback = object : Callback {}) : HttpClient
An implementation of HttpClient using the native HttpURLConnection.
HttpClient [androidJvm]
interface HttpClient
An HTTP client performs HTTP requests.
HttpException [androidJvm]
class HttpException(val kind: HttpException.Kind, val mediaType: MediaType? = null, val body: ByteArray? = null, cause: Throwable? = null) : UserException
Represents an error occurring during an HTTP activity.
HttpFetchResponse [androidJvm]
class HttpFetchResponse(val response: HttpResponse, val body: ByteArray)
HttpHeaders [androidJvm]
data class HttpHeaders(val headers: Map<String, List<String>>)
Helper to parse HTTP request/response headers.
HttpRange [androidJvm]
data class HttpRange(val start: Long, val end: Long?)
HTTP content range.
HttpRequest [androidJvm]
class HttpRequest(val url: String, val method: HttpRequest.Method = Method.GET, val headers: Map<String, String> = mapOf(), val body: HttpRequest.Body? = null, val extras: Bundle = Bundle(), val connectTimeout: Duration? = null, val readTimeout: Duration? = null, val allowUserInteraction: Boolean = false) : Serializable
Holds the information about an HTTP request performed by an HttpClient.
HttpResponse [androidJvm]
data class HttpResponse(val request: HttpRequest, val url: String, val statusCode: Int, val headers: Map<String, List<String>>, val mediaType: MediaType)
Represents a successful HTTP response received from a server.
HttpStreamResponse [androidJvm]
class HttpStreamResponse(val response: HttpResponse, val body: InputStream)
HttpTry [androidJvm]
typealias HttpTry<SuccessT> = Try<SuccessT, HttpException>
ProblemDetails [androidJvm]
data class ProblemDetails(val title: String, val type: String? = null, val status: Int? = null, val detail: String? = null, val instance: String? = null) : Parcelable
Problem Details for HTTP APIs.

Functions

Name Summary
fetchJSONObject [androidJvm]
suspend fun HttpClient.fetchJSONObject(request: HttpRequest): HttpTry<JSONObject>
Fetches the resource from the given request as a JSONObject.
fetchString [androidJvm]
suspend fun HttpClient.fetchString(request: HttpRequest, charset: Charset = Charsets.UTF_8): HttpTry<String>
Fetches the resource from the given request as a String.
fetchWithDecoder [androidJvm]
suspend fun <T> HttpClient.fetchWithDecoder(request: HttpRequest, decoder: (HttpFetchResponse) -> T): HttpTry<T>
Fetches the resource from the given request before decoding it with the provided decoder.