Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder
Builder for QuicOptions
.
Summary
Public methods |
QuicOptions.Builder |
Adds a host to the QUIC allowlist.
|
QuicOptions |
Creates and returns the final QuicOptions instance, based on the values in this builder.
|
QuicOptions.Builder |
Sets the user agent to be used outside of HTTP requests (for example for QUIC handshakes).
|
QuicOptions.Builder |
Sets the maximum idle time for a connection.
|
QuicOptions.Builder |
Sets how many server configurations (metadata like list of alt svc, whether QUIC is supported, etc.) should be held in memory.
|
Public constructors
Public methods
addAllowedQuicHost
fun addAllowedQuicHost(quicHost: String): QuicOptions.Builder
Adds a host to the QUIC allowlist.
If no hosts are specified, the per-host allowlist functionality is disabled. Otherwise, the HTTP stack will only use QUIC when talking to hosts on the allowlist.
Parameters |
quicHost |
String: This value cannot be null . |
build
fun build(): QuicOptions
Creates and returns the final QuicOptions
instance, based on the values in this builder.
setHandshakeUserAgent
fun setHandshakeUserAgent(handshakeUserAgent: String): QuicOptions.Builder
Sets the user agent to be used outside of HTTP requests (for example for QUIC handshakes).
To set the default user agent for HTTP requests, use HttpEngine.Builder.setUserAgent(String)
instead.
Parameters |
handshakeUserAgent |
String: This value cannot be null . |
setIdleConnectionTimeout
fun setIdleConnectionTimeout(idleConnectionTimeout: Duration): QuicOptions.Builder
Sets the maximum idle time for a connection. The actual value for the idle timeout is the minimum of this value and the server's and is negotiated during the handshake. Thus, it only applies after the handshake has completed. If no activity is detected on the connection for the set duration, the connection is closed.
See RFC 9114, section 5.1 for more details.
Parameters |
idleConnectionTimeout |
Duration: This value cannot be null . |
setInMemoryServerConfigsCacheSize
fun setInMemoryServerConfigsCacheSize(inMemoryServerConfigsCacheSize: Int): QuicOptions.Builder
Sets how many server configurations (metadata like list of alt svc, whether QUIC is supported, etc.) should be held in memory.
If the storage path is set (HttpEngine.Builder.setStoragePath(String)
, the HTTP stack will also persist the server configurations on disk.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# QuicOptions.Builder\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [S Extensions 7](https://developer.android.com/sdkExtensions)\n\nBuilder\n=======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/net/http/QuicOptions.Builder \"View this page in Java\") \n\n```\nclass Builder\n```\n\n|---|-------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.net.http.QuicOptions.Builder](#) |\n\nBuilder for [QuicOptions](/reference/kotlin/android/net/http/QuicOptions).\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------|---|\n| [Builder](#Builder())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|---------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [QuicOptions.Builder](#) | [addAllowedQuicHost](#addAllowedQuicHost(kotlin.String))`(`quicHost:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Adds a host to the QUIC allowlist. |\n| [QuicOptions](/reference/kotlin/android/net/http/QuicOptions) | [build](#build())`()` Creates and returns the final [QuicOptions](/reference/kotlin/android/net/http/QuicOptions) instance, based on the values in this builder. |\n| [QuicOptions.Builder](#) | [setHandshakeUserAgent](#setHandshakeUserAgent(kotlin.String))`(`handshakeUserAgent:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Sets the user agent to be used outside of HTTP requests (for example for QUIC handshakes). |\n| [QuicOptions.Builder](#) | [setIdleConnectionTimeout](#setIdleConnectionTimeout(java.time.Duration))`(`idleConnectionTimeout:` `[Duration](../../../java/time/Duration.html#)`)` Sets the maximum idle time for a connection. |\n| [QuicOptions.Builder](#) | [setInMemoryServerConfigsCacheSize](#setInMemoryServerConfigsCacheSize(kotlin.Int))`(`inMemoryServerConfigsCacheSize:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets how many server configurations (metadata like list of alt svc, whether QUIC is supported, etc.) should be held in memory. |\n\nPublic constructors\n-------------------\n\n### Builder\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [S Extensions 7](https://developer.android.com/sdkExtensions) \n\n```\nBuilder()\n```\n\nPublic methods\n--------------\n\n### addAllowedQuicHost\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [S Extensions 7](https://developer.android.com/sdkExtensions) \n\n```\nfun addAllowedQuicHost(quicHost: String): QuicOptions.Builder\n```\n\nAdds a host to the QUIC allowlist.\n\nIf no hosts are specified, the per-host allowlist functionality is disabled. Otherwise, the HTTP stack will only use QUIC when talking to hosts on the allowlist.\n\n| Parameters ||\n|------------|----------------------------------------------------------------------------------------------------------------|\n| `quicHost` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): This value cannot be `null`. |\n\n| Return ||\n|--------------------------|-------------------------------------------------------|\n| [QuicOptions.Builder](#) | the builder for chaining This value cannot be `null`. |\n\n### build\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [S Extensions 7](https://developer.android.com/sdkExtensions) \n\n```\nfun build(): QuicOptions\n```\n\nCreates and returns the final [QuicOptions](/reference/kotlin/android/net/http/QuicOptions) instance, based on the values in this builder.\n\n| Return ||\n|---------------------------------------------------------------|------------------------------|\n| [QuicOptions](/reference/kotlin/android/net/http/QuicOptions) | This value cannot be `null`. |\n\n### setHandshakeUserAgent\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [S Extensions 7](https://developer.android.com/sdkExtensions) \n\n```\nfun setHandshakeUserAgent(handshakeUserAgent: String): QuicOptions.Builder\n```\n\nSets the user agent to be used outside of HTTP requests (for example for QUIC handshakes).\n\nTo set the default user agent for HTTP requests, use [HttpEngine.Builder.setUserAgent(String)](/reference/kotlin/android/net/http/HttpEngine.Builder#setUserAgent(kotlin.String)) instead.\n\n| Parameters ||\n|----------------------|----------------------------------------------------------------------------------------------------------------|\n| `handshakeUserAgent` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): This value cannot be `null`. |\n\n| Return ||\n|--------------------------|-------------------------------------------------------|\n| [QuicOptions.Builder](#) | the builder for chaining This value cannot be `null`. |\n\n### setIdleConnectionTimeout\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [S Extensions 7](https://developer.android.com/sdkExtensions) \n\n```\nfun setIdleConnectionTimeout(idleConnectionTimeout: Duration): QuicOptions.Builder\n```\n\nSets the maximum idle time for a connection. The actual value for the idle timeout is the minimum of this value and the server's and is negotiated during the handshake. Thus, it only applies after the handshake has completed. If no activity is detected on the connection for the set duration, the connection is closed.\n\nSee [RFC 9114, section 5.1](https://www.rfc-editor.org/rfc/rfc9114.html#name-idle-connections) for more details.\n\n| Parameters ||\n|-------------------------|-----------------------------------------------------------------------------|\n| `idleConnectionTimeout` | [Duration](../../../java/time/Duration.html#): This value cannot be `null`. |\n\n| Return ||\n|--------------------------|-------------------------------------------------------|\n| [QuicOptions.Builder](#) | the builder for chaining This value cannot be `null`. |\n\n### setInMemoryServerConfigsCacheSize\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [S Extensions 7](https://developer.android.com/sdkExtensions) \n\n```\nfun setInMemoryServerConfigsCacheSize(inMemoryServerConfigsCacheSize: Int): QuicOptions.Builder\n```\n\nSets how many server configurations (metadata like list of alt svc, whether QUIC is supported, etc.) should be held in memory.\n\nIf the storage path is set ([HttpEngine.Builder.setStoragePath(String)](/reference/kotlin/android/net/http/HttpEngine.Builder#setStoragePath(kotlin.String)), the HTTP stack will also persist the server configurations on disk.\n\n| Return ||\n|--------------------------|-------------------------------------------------------|\n| [QuicOptions.Builder](#) | the builder for chaining This value cannot be `null`. |"]]