Package org.attribyte.api.http
Class ClientOptions
java.lang.Object
org.attribyte.api.http.ClientOptions
Configuration options for clients.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilds immutable instances of client options. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal intThe maximum amount of time to wait to establish a connection (5s).final CookieStoreThe cookie store, if any.final booleanShould redirects be followed (true).static final ClientOptionsIndicates that implementation defaults should be used.final intThe maximum number of connections per destination (1024).final intThe maximum number of connections for all destinations (4096).final StringA proxy server.final intThe proxy server port.final intThe request buffer size (4096).final intThe maximum amount of time to wait for a response after sending a request (5s).final intThe response buffer size (16384).final intThe maximum amount of time to wait for a (blocking) socket read to return (5s).final booleanShould SSL certificates be trusted even if invalid (false).final StringThe user agent ('AttribyteHttp/1.0'). -
Constructor Summary
ConstructorsConstructorDescriptionClientOptions(String prefix, Properties props) Creates options from properties. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetBooleanProperty(String name, boolean defaultValue) Gets a boolean property.intgetIntProperty(String name, int defaultValue) Gets an integer property.getProperty(String name, String defaultValue) Gets a property.intgetTimeProperty(String name, int defaultValue) Gets a time (string) property as milliseconds.toString()
-
Field Details
-
IMPLEMENTATION_DEFAULT
Indicates that implementation defaults should be used. -
userAgent
The user agent ('AttribyteHttp/1.0'). -
connectionTimeoutMillis
public final int connectionTimeoutMillisThe maximum amount of time to wait to establish a connection (5s). -
requestTimeoutMillis
public final int requestTimeoutMillisThe maximum amount of time to wait for a response after sending a request (5s). -
socketTimeoutMillis
public final int socketTimeoutMillisThe maximum amount of time to wait for a (blocking) socket read to return (5s). -
proxyHost
A proxy server. -
proxyPort
public final int proxyPortThe proxy server port. -
followRedirects
public final boolean followRedirectsShould redirects be followed (true). -
maxConnectionsPerDestination
public final int maxConnectionsPerDestinationThe maximum number of connections per destination (1024). -
maxConnectionsTotal
public final int maxConnectionsTotalThe maximum number of connections for all destinations (4096). -
requestBufferSize
public final int requestBufferSizeThe request buffer size (4096). -
responseBufferSize
public final int responseBufferSizeThe response buffer size (16384). -
trustAllCertificates
public final boolean trustAllCertificatesShould SSL certificates be trusted even if invalid (false). -
cookieStore
The cookie store, if any.
-
-
Constructor Details
-
ClientOptions
public ClientOptions(String prefix, Properties props) throws org.attribyte.api.InitializationException Creates options from properties.- Parameters:
prefix- A prefix applied to all property names.props- The properties.- Throws:
org.attribyte.api.InitializationException- on invalid property.
-
-
Method Details
-
toString
-
getProperty
Gets a property.- Parameters:
name- The property name.defaultValue- The default value.- Returns:
- The property or default value.
-
getIntProperty
Gets an integer property.- Parameters:
name- The property name.defaultValue- The default value.- Returns:
- The property or default value.
-
getBooleanProperty
Gets a boolean property.- Parameters:
name- The property name.defaultValue- The default value.- Returns:
- The property or default value.
-
getTimeProperty
Gets a time (string) property as milliseconds.- Parameters:
name- The property name.defaultValue- The default value.- Returns:
- The property or default value.
-