Package com.mapbox.mapboxsdk.http

Do not use this package. Internal use only.

Types

Name Summary
HttpIdentifier
open class HttpIdentifier
HttpLogger
open class HttpLogger
HttpRequest
interface HttpRequest
Interface definition for performing http requests.
HttpRequestUrl
open class HttpRequestUrl
HttpResponder
interface HttpResponder
Interface definition for a callback to be invoked when either a response was returned for a requested resource or when an error occurred when requesting the resource.
LocalRequestTask
open class LocalRequestTask : AsyncTask<String, Void, Array>
NativeHttpRequest
open class NativeHttpRequest : HttpResponder

HttpIdentifier

open class HttpIdentifier

Functions

Name Summary
getIdentifier
open fun getIdentifier(): String
Returns the application identifier, consisting out the package name, version name and version code.

getIdentifier

open fun getIdentifier(): String

Returns the application identifier, consisting out the package name, version name and version code.

Return

the application identifier

HttpLogger

open class HttpLogger

Functions

Name Summary
log
open fun log(type: Int, errorMessage: String)
logFailure
open fun logFailure(type: Int, errorMessage: String, requestUrl: String)

Properties

Name Summary
logEnabled open val logEnabled: Boolean
logRequestUrl open val logRequestUrl: Boolean

logEnabled

open val logEnabled: Boolean

logFailure

open fun logFailure(type: Int, errorMessage: String, requestUrl: String)

logRequestUrl

open val logRequestUrl: Boolean

log

open fun log(type: Int, errorMessage: String)

HttpRequest

interface HttpRequest

Interface definition for performing http requests.

This allows to provide alternative implementations for the http interaction of this library.

Functions

Name Summary
cancelRequest
abstract fun cancelRequest()
Cancels the request.
executeRequest
abstract fun executeRequest(httpRequest: HttpResponder, nativePtr: Long, resourceUrl: String, etag: String, modified: String, offlineUsage: Boolean)
Executes the request.

Properties

Name Summary
CONNECTION_ERROR val CONNECTION_ERROR: Int
PERMANENT_ERROR val PERMANENT_ERROR: Int
TEMPORARY_ERROR val TEMPORARY_ERROR: Int

Inheritors

Name
HttpRequestImpl

CONNECTION_ERROR

val CONNECTION_ERROR: Int

PERMANENT_ERROR

val PERMANENT_ERROR: Int

TEMPORARY_ERROR

val TEMPORARY_ERROR: Int

cancelRequest

abstract fun cancelRequest()

Cancels the request.

executeRequest

abstract fun executeRequest(httpRequest: HttpResponder, nativePtr: Long, resourceUrl: String, etag: String, modified: String, offlineUsage: Boolean)

Executes the request.

Parameters
Name Summary
httpRequest
callback to be invoked when we receive a response
nativePtr
the pointer associated to the request
resourceUrl
the resource url to download
etag
http header, identifier for a specific version of a resource
modified
http header, used to determine if a resource hasn’t been modified since
offlineUsage
flag to indicate a resource will be used for offline, appends offline=true as a query parameter
   
   

HttpRequestUrl

open class HttpRequestUrl

Functions

Name Summary
buildResourceUrl
open fun buildResourceUrl(host: String, resourceUrl: String, querySize: Int, offline: Boolean): String
Adapts a resource request url based on the host, query size, and offline requirement.Mapbox resources downloaded for offline use are subject to separate Vector Tile andRaster Tile API pricing and are not included in the Maps SDK’s “unlimited” requests.

buildResourceUrl

open fun buildResourceUrl(host: String, resourceUrl: String, querySize: Int, offline: Boolean): String

Adapts a resource request url based on the host, query size, and offline requirement.Mapbox resources downloaded for offline use are subject to separate Vector Tile andRaster Tile API pricing and are not included in the Maps SDK’s “unlimited” requests.See our pricing page for more information.

Return

the adapted resource url

Parameters
Name Summary
host
the host used as endpoint
resourceUrl
the resource to download
querySize
the query size of the resource request
offline
the type of resource, either offline or online
   
   

HttpResponder

interface HttpResponder

Interface definition for a callback to be invoked when either a response was returned for a requested resource or when an error occurred when requesting the resource.

Functions

Name Summary
handleFailure
abstract fun handleFailure(type: Int, errorMessage: String)
Invoked when a resource failed to be retrieved.
onResponse
abstract fun onResponse(responseCode: Int, eTag: String, lastModified: String, cacheControl: String, expires: String, retryAfter: String, xRateLimitReset: String, body: Array)
Invoked when a resource has finished.

Inheritors

Name
NativeHttpRequest

handleFailure

abstract fun handleFailure(type: Int, errorMessage: String)

Invoked when a resource failed to be retrieved.

Parameters
Name Summary
type
the error type, either one of CONNECTION_ERROR,TEMPORARY_ERROR or PERMANENT_ERROR
errorMessage
the error message associated with the failure
   
   

onResponse

abstract fun onResponse(responseCode: Int, eTag: String, lastModified: String, cacheControl: String, expires: String, retryAfter: String, xRateLimitReset: String, body: Array)

Invoked when a resource has finished.

Parameters
Name Summary
responseCode
http response code
eTag
http header, identifier for a specific version of a resource
lastModified
http header, used to determine if a resource hasn’t been modified since
cacheControl
http header, used to determine cache strategy of a resource
expires
http header, used to determine when a resource is stale
retryAfter
http header, used to indicate when the service is expected to be unavailable to the client
xRateLimitReset
http header, used to determine the remaining window before the rate limit resets
body
http response body, in an array of bytes representation
   
   

LocalRequestTask

open class LocalRequestTask : AsyncTask<String, Void, Array>

Constructors

Name Summary
LocalRequestTask open fun LocalRequestTask(requestResponse: LocalRequestTask.OnLocalRequestResponse)

Types

Name Summary
OnLocalRequestResponse
interface OnLocalRequestResponse

Functions

Name Summary
cancel
fun cancel(mayInterruptIfRunning: Boolean): Boolean
doInBackground
abstract fun doInBackground(p: Array): Result
execute
fun execute(params: Array): AsyncTask<Params, Progress, Result>
open fun [execute](../com.mapbox.mapboxsdk.utils#execute)(runnable: Runnable)
executeOnExecutor
fun executeOnExecutor(exec: Executor, params: Array): AsyncTask<Params, Progress, Result>
get
fun get(): Result
getStatus
fun getStatus(): AsyncTask.Status
isCancelled
fun isCancelled(): Boolean
onCancelled
open fun onCancelled(result: Result)
onPostExecute
open fun onPostExecute(result: Result)
onPreExecute
open fun onPreExecute()
onProgressUpdate
open fun onProgressUpdate(values: Array)
publishProgress
fun publishProgress(values: Array)

OnLocalRequestResponse

interface OnLocalRequestResponse

Functions

Name Summary
onResponse
abstract fun onResponse(bytes: Array)

onResponse

abstract fun onResponse(bytes: Array)

NativeHttpRequest

open class NativeHttpRequest : HttpResponder

Functions

Name Summary
cancel
open fun cancel()
handleFailure
open fun handleFailure(type: Int, errorMessage: String)
Invoked when a resource failed to be retrieved.
onResponse
abstract fun onResponse(responseCode: Int, eTag: String, lastModified: String, cacheControl: String, expires: String, retryAfter: String, xRateLimitReset: String, body: Array)
open fun [onResponse](#onresponse)(responseCode: Int, etag: String, lastModified: String, cacheControl: String, expires: String, retryAfter: String, xRateLimitReset: String, body: Array)
Invoked when a resource has finished.

cancel

open fun cancel()

handleFailure

open fun handleFailure(type: Int, errorMessage: String)

Invoked when a resource failed to be retrieved.

Parameters
Name Summary
type
the error type, either one of CONNECTION_ERROR,TEMPORARY_ERROR or PERMANENT_ERROR
errorMessage
the error message associated with the failure
   
   

onResponse

open fun onResponse(responseCode: Int, etag: String, lastModified: String, cacheControl: String, expires: String, retryAfter: String, xRateLimitReset: String, body: Array)

Invoked when a resource has finished.

Parameters
Name Summary
responseCode
http response code
eTag
http header, identifier for a specific version of a resource
lastModified
http header, used to determine if a resource hasn’t been modified since
cacheControl
http header, used to determine cache strategy of a resource
expires
http header, used to determine when a resource is stale
retryAfter
http header, used to indicate when the service is expected to be unavailable to the client
xRateLimitReset
http header, used to determine the remaining window before the rate limit resets
body
http response body, in an array of bytes representation