Record Class HttpClientSettings
java.lang.Object
java.lang.Record
org.springframework.boot.http.client.HttpClientSettings
- Record Components:
- the cookie handling strategy to use or null to use the underlying library's defaultredirects- the follow redirect strategy to use or null to redirect whenever the underlying library allows itconnectTimeout- the connect timeoutreadTimeout- the read timeoutsslBundle- the SSL bundle providing SSL configuration
public record HttpClientSettings(@Nullable HttpCookieHandling cookieHandling, @Nullable HttpRedirects redirects, @Nullable Duration connectTimeout, @Nullable Duration readTimeout, @Nullable SslBundle sslBundle)
extends Record
Settings that can be applied when creating an imperative or reactive HTTP client.
- Since:
- 3.5.0
- Author:
- Phillip Webb
-
Constructor Summary
ConstructorsConstructorDescriptionHttpClientSettings(@Nullable HttpCookieHandling cookieHandling, @Nullable HttpRedirects redirects, @Nullable Duration connectTimeout, @Nullable Duration readTimeout, @Nullable SslBundle sslBundle) Creates an instance of aHttpClientSettingsrecord class.HttpClientSettings(@Nullable HttpRedirects redirects, @Nullable Duration connectTimeout, @Nullable Duration readTimeout, @Nullable SslBundle sslBundle) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescription@Nullable DurationReturns the value of theconnectTimeoutrecord component.@Nullable HttpCookieHandlingReturns the value of thecookieHandlingrecord component.static HttpClientSettingsdefaults()Use defaults settings, which can differ depending on the implementation.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static HttpClientSettingsofSslBundle(@Nullable SslBundle sslBundle) Return a newHttpClientSettingsusing defaults for all settings other than the provided SSL bundle.orElse(@Nullable HttpClientSettings other) Return a newHttpClientSettingsinstance using values from this instance when they are present, or otherwise using values fromother.@Nullable DurationReturns the value of thereadTimeoutrecord component.@Nullable HttpRedirectsReturns the value of theredirectsrecord component.@Nullable SslBundleReturns the value of thesslBundlerecord component.final StringtoString()Returns a string representation of this record class.withConnectTimeout(@Nullable Duration connectTimeout) Return a newHttpClientSettingsinstance with an updated connect timeout setting.withCookieHandling(@Nullable HttpCookieHandling cookieHandling) Return a newHttpClientSettingsinstance with an updated cookie handling setting.withReadTimeout(@Nullable Duration readTimeout) Return a newHttpClientSettingsinstance with an updated read timeout setting.withRedirects(@Nullable HttpRedirects redirects) Return a newHttpClientSettingsinstance with an updated redirect setting.withSslBundle(@Nullable SslBundle sslBundle) Return a newHttpClientSettingsinstance with an updated SSL bundle setting.withTimeouts(@Nullable Duration connectTimeout, @Nullable Duration readTimeout) Return a newHttpClientSettingsinstance with an updated connect and read timeout setting.
-
Constructor Details
-
HttpClientSettings
@Deprecated(since="4.1.0", forRemoval=true) public HttpClientSettings(@Nullable HttpRedirects redirects, @Nullable Duration connectTimeout, @Nullable Duration readTimeout, @Nullable SslBundle sslBundle) Deprecated, for removal: This API element is subject to removal in a future version.since 4.1.0 for removal in 4.3.0 in favor ofHttpClientSettings(HttpCookieHandling, HttpRedirects, Duration, Duration, SslBundle)Create a newHttpClientSettingsinstance.- Parameters:
redirects- the follow redirect strategy to useconnectTimeout- the connect timeoutreadTimeout- the read timeoutsslBundle- the SSL bundle providing SSL configuration
-
HttpClientSettings
public HttpClientSettings(@Nullable HttpCookieHandling cookieHandling, @Nullable HttpRedirects redirects, @Nullable Duration connectTimeout, @Nullable Duration readTimeout, @Nullable SslBundle sslBundle) Creates an instance of aHttpClientSettingsrecord class.- Parameters:
cookieHandling- the value for thecookieHandlingrecord componentredirects- the value for theredirectsrecord componentconnectTimeout- the value for theconnectTimeoutrecord componentreadTimeout- the value for thereadTimeoutrecord componentsslBundle- the value for thesslBundlerecord component
-
-
Method Details
-
withCookieHandling
Return a newHttpClientSettingsinstance with an updated cookie handling setting.- Parameters:
cookieHandling- the new cookie handling setting- Returns:
- a new
HttpClientSettingsinstance - Since:
- 4.1.0
-
withConnectTimeout
Return a newHttpClientSettingsinstance with an updated connect timeout setting.- Parameters:
connectTimeout- the new connect timeout setting- Returns:
- a new
HttpClientSettingsinstance - Since:
- 4.0.0
-
withReadTimeout
Return a newHttpClientSettingsinstance with an updated read timeout setting.- Parameters:
readTimeout- the new read timeout setting- Returns:
- a new
HttpClientSettingsinstance - Since:
- 4.0.0
-
withTimeouts
public HttpClientSettings withTimeouts(@Nullable Duration connectTimeout, @Nullable Duration readTimeout) Return a newHttpClientSettingsinstance with an updated connect and read timeout setting.- Parameters:
connectTimeout- the new connect timeout settingreadTimeout- the new read timeout setting- Returns:
- a new
HttpClientSettingsinstance - Since:
- 4.0.0
-
withSslBundle
Return a newHttpClientSettingsinstance with an updated SSL bundle setting.- Parameters:
sslBundle- the new SSL bundle setting- Returns:
- a new
HttpClientSettingsinstance - Since:
- 4.0.0
-
withRedirects
Return a newHttpClientSettingsinstance with an updated redirect setting.- Parameters:
redirects- the new redirects setting- Returns:
- a new
HttpClientSettingsinstance - Since:
- 4.0.0
-
orElse
Return a newHttpClientSettingsinstance using values from this instance when they are present, or otherwise using values fromother.- Parameters:
other- the settings to be used to obtain values not present in this instance- Returns:
- a new
HttpClientSettingsinstance - Since:
- 4.0.0
-
ofSslBundle
Return a newHttpClientSettingsusing defaults for all settings other than the provided SSL bundle.- Parameters:
sslBundle- the SSL bundle setting- Returns:
- a new
HttpClientSettingsinstance - Since:
- 4.0.0
-
defaults
Use defaults settings, which can differ depending on the implementation.- Returns:
- default settings
- Since:
- 4.0.0
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
cookieHandling
Returns the value of thecookieHandlingrecord component.- Returns:
- the value of the
cookieHandlingrecord component
-
redirects
-
connectTimeout
Returns the value of theconnectTimeoutrecord component.- Returns:
- the value of the
connectTimeoutrecord component
-
readTimeout
Returns the value of thereadTimeoutrecord component.- Returns:
- the value of the
readTimeoutrecord component
-
sslBundle
-
HttpClientSettings(HttpCookieHandling, HttpRedirects, Duration, Duration, SslBundle)