PrerenderParameters.Builder


class PrerenderParameters.Builder


A builder class to use to construct the PrerenderParameters.

Summary

Public constructors

Construct a new Builder.

Public functions

PrerenderParameters.Builder

Sets the header value for the given key.

PrerenderParameters.Builder

Sets multiple headers at once.

PrerenderParameters

Build the PrerenderParameters.

PrerenderParameters.Builder

Sets the No-Vary-Search data that's expected to be returned via the header in the prefetch's response.

PrerenderParameters.Builder

Sets an optional variations ID to associate with this prefetch request.

Public constructors

Builder

Builder()

Construct a new Builder.

Public functions

addAdditionalHeader

@Profile.ExperimentalUrlPrefetch
fun addAdditionalHeader(key: String, value: String): PrerenderParameters.Builder

Sets the header value for the given key. If called multiple times for the same key, the last value will be used.

Header keys must be RFC 2616 -compliant.

The logic for handling additional header isn't guaranteed to match the loadUrl's logic and is subject to change in the future.

Parameters
key: String

The header key.

value: String

The header value.

Returns
PrerenderParameters.Builder

This builder instance for chaining.

addAdditionalHeaders

@Profile.ExperimentalUrlPrefetch
fun addAdditionalHeaders(additionalHeaders: (Mutable)Map<String!, String!>): PrerenderParameters.Builder

Sets multiple headers at once. The headers passed in here will be merged with any that have been previously set (duplicate keys will be overridden).

Header keys must be RFC 2616 compliant.

Parameters
additionalHeaders: (Mutable)Map<String!, String!>

A map of additional headers to set.

Returns
PrerenderParameters.Builder

This builder instance for chaining.

setExpectedNoVarySearchData

@Profile.ExperimentalUrlPrefetch
fun setExpectedNoVarySearchData(
    expectedNoVarySearchHeader: NoVarySearchHeader
): PrerenderParameters.Builder

Sets the No-Vary-Search data that's expected to be returned via the header in the prefetch's response.

This is used to help determine if WebView#loadUrl should either use an in-flight prefetch response to render the web contents or handle the URL as it typically does (i.e. start a network request).

Parameters
expectedNoVarySearchHeader: NoVarySearchHeader

The No-Vary-Search data expected to be returned in the prefetch's response.

Returns
PrerenderParameters.Builder

This builder instance for chaining.

setVariationsId

@Profile.ExperimentalUrlPrefetch
fun setVariationsId(variationsId: Int?): PrerenderParameters.Builder

Sets an optional variations ID to associate with this prefetch request.

Parameters
variationsId: Int?

An Integer ID for this prefetch configuration, or null if no specific variations ID is applicable.

Returns
PrerenderParameters.Builder

This builder instance for chaining.