Package org.onyx.http
Class Client.Builder
java.lang.Object
org.onyx.http.Client.Builder
- Enclosing class:
Client
A builder class for creating client objects
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a client with all of the provided parameters.setConnectionPool(int maxIdle, long timeout, TimeUnit unit) Sets the connection pool for the clientsetConnectTimeout(long timeout, TimeUnit unit) Sets the connect timeout for the clientsetCredential(String credential) Sets the credential for the clientsetLedgerName(String name) Sets the ledger name for the client.setLogger(OutputStream logger) Sets the request logger.Sets the level of the request logger.Sets the proxy for the clientsetReadTimeout(long timeout, TimeUnit unit) Sets the read timeout for the clientsetWriteTimeout(long timeout, TimeUnit unit) Sets the write timeout for the client
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setCredential
Sets the credential for the client- Parameters:
credential- an API credential from a user of the ledger's team
-
setLedgerName
Sets the ledger name for the client. The client will access the named ledger.- Parameters:
name- The ledger name
-
setConnectTimeout
Sets the connect timeout for the client- Parameters:
timeout- the number of time units for the default timeoutunit- the unit of time
-
setReadTimeout
Sets the read timeout for the client- Parameters:
timeout- the number of time units for the default timeoutunit- the unit of time
-
setWriteTimeout
Sets the write timeout for the client- Parameters:
timeout- the number of time units for the default timeoutunit- the unit of time
-
setProxy
Sets the proxy for the client- Parameters:
proxy-
-
setConnectionPool
Sets the connection pool for the client- Parameters:
maxIdle- the maximum number of idle http connections in the pooltimeout- the number of time units until an idle http connection in the pool is closedunit- the unit of time
-
setLogger
Sets the request logger.- Parameters:
logger- the output stream to log the requests to
-
setLogLevel
Sets the level of the request logger.- Parameters:
level- all, errors or none
-
build
Builds a client with all of the provided parameters.- Throws:
ConfigurationException
-