java.lang.Object
de.cuioss.http.client.handler.HttpHandler.HttpHandlerBuilder
- Enclosing class:
HttpHandler
Builder for creating
HttpHandler instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a newHttpHandlerinstance with the configured parameters.connectionTimeoutSeconds(int connectionTimeoutSeconds) Sets the connection timeout in seconds for HTTP requests.readTimeoutSeconds(int readTimeoutSeconds) Sets the read timeout in seconds for HTTP requests.sslContext(@Nullable SSLContext sslContext) Sets the SSL context to use for HTTPS connections.tlsVersions(@Nullable SecureSSLContextProvider secureSSLContextProvider) Sets the TLS versions configuration.Sets the URI as a string.Sets the URI directly.Sets the URL as a string.Sets the URL directly.
-
Constructor Details
-
HttpHandlerBuilder
public HttpHandlerBuilder()
-
-
Method Details
-
uri
Sets the URI as a string.- Parameters:
uriString- The string representation of the URI. Must not be null or empty.- Returns:
- This builder instance.
- Throws:
IllegalArgumentException- if the URI string is null, empty, or malformed (thrown during thebuild()method execution, not by this setter method)
-
uri
Sets the URI directly.Note: If both URI and URL are set, the URI takes precedence.
- Parameters:
uri- The URI to be used for HTTP requests. Must not be null.- Returns:
- This builder instance.
-
url
Sets the URL as a string.Note: This method is provided for backward compatibility. Consider using
uri(String)instead.- Parameters:
urlString- The string representation of the URL. Must not be null or empty.- Returns:
- This builder instance.
- Throws:
IllegalArgumentException- if the URL string is null, empty, or malformed (thrown during thebuild()method execution, not by this setter method)
-
url
Sets the URL directly.Note: This method is provided for backward compatibility. Consider using
uri(URI)instead.If both URI and URL are set, the URI takes precedence.
- Parameters:
url- The URL to be used for HTTP requests. Must not be null.- Returns:
- This builder instance.
-
sslContext
Sets the SSL context to use for HTTPS connections.If not set, a default secure SSL context will be created.
- Parameters:
sslContext- The SSL context to use.- Returns:
- This builder instance.
-
tlsVersions
public HttpHandler.HttpHandlerBuilder tlsVersions(@Nullable SecureSSLContextProvider secureSSLContextProvider) Sets the TLS versions configuration.- Parameters:
secureSSLContextProvider- The TLS versions configuration to use.- Returns:
- This builder instance.
-
connectionTimeoutSeconds
Sets the connection timeout in seconds for HTTP requests.If not set, a default timeout of 10 seconds will be used.
- Parameters:
connectionTimeoutSeconds- The connection timeout in seconds. Must be positive.- Returns:
- This builder instance.
-
readTimeoutSeconds
Sets the read timeout in seconds for HTTP requests.If not set, a default timeout of 10 seconds will be used.
- Parameters:
readTimeoutSeconds- The read timeout in seconds. Must be positive.- Returns:
- This builder instance.
-
build
Builds a newHttpHandlerinstance with the configured parameters.- Returns:
- A new
HttpHandlerinstance. - Throws:
IllegalArgumentException- If any parameter is invalid.
-