org.opensaml.ws.soap.client.http
@NotThreadSafe public class HttpClientBuilder extends Object
HttpClient
s.
This builder will produce clients that employ the MultiThreadedHttpConnectionManager
and as such users of the
clients MUST be sure to invoke HttpMethod.releaseConnection()
after they have
finished with the method.Modifier and Type | Field and Description |
---|---|
private int |
connectionRetryAttempts
Number of times a failed connection to a host should be retried.
|
private int |
connectionTimeout
Amount of time, in milliseconds, to wait for a connection to be established, default is 5,000.
|
private String |
contentCharSet
Character set used for HTTP content, defaults to UTF-8.
|
private org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory |
httpsProtocolSocketFactory
Socket factory used for the 'https' scheme.
|
private int |
maxConnectionsPerHost
Total number of connections allowed to a specific host, defaults to 5.
|
private int |
maxTotalConnectons
Total number of connections allowed to all hosts, defaults to 20.
|
private boolean |
preemptiveAuthentication
Whether authentication should be performed preemptively, defaults to false.
|
private String |
proxyHost
Host name of the HTTP proxy server through which connections will be made.
|
private String |
proxyPassword
Password used to connect to the HTTP proxy server.
|
private int |
proxyPort
Port number of the HTTP proxy server through which connections will be made.
|
private String |
proxyUsername
Username used to connect to the HTTP proxy server.
|
private int |
receiveBufferSize
Size of the buffer, in bytes, used to hold inbound information, defaults to 16,384.
|
private int |
sendBufferSize
Size of the buffer, in bytes, used to hold outbound information, defaults to 4,096.
|
private boolean |
tcpNoDelay
Whether to use TCP No Delay algorithm, defaults to true.
|
Constructor and Description |
---|
HttpClientBuilder()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
org.apache.commons.httpclient.HttpClient |
buildClient()
Builds an HTTP client with the given settings.
|
int |
getConnectionRetryAttempts()
Gets the number of times a connection will be tried if a host is unreachable.
|
int |
getConnectionTimeout()
Gets the time, in milliseconds, to wait for connection establishments.
|
String |
getContentCharSet()
Gets the character set used for HTTP content.
|
org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory |
getHttpsProtocolSocketFactory()
Gets the protocol socket factory used for the https scheme.
|
int |
getMaxConnectionsPerHost()
Gets the maximum number of connections, per host, that the client will create.
|
int |
getMaxTotalConnections()
Gets the maximum number of total connections the client will create.
|
String |
getProxyHost()
Gets the host name of the HTTP proxy server through which connections will be made.
|
String |
getProxyPassword()
Gets the password used to connect to the HTTP proxy server.
|
int |
getProxyPort()
Gets the port of the HTTP proxy server through which connections will be made.
|
String |
getProxyUsername()
Gets the username used to connect to the HTTP proxy server.
|
int |
getReceiveBufferSize()
Gets the size of buffer, in bytes, used when receiving content.
|
int |
getSendBufferSize()
Gets the size of buffer, in bytes, used when sending content.
|
boolean |
isPreemptiveAuthentication()
Gets whether authentication is performed preemptively.
|
boolean |
isTcpNoDelay()
Gets whether to use TCP No Delay when sending data.
|
void |
resetDefaults()
Resets the builder to its default values.
|
void |
setConnectionRetryAttempts(int attempts)
Sets the number of times a connection will be tried if a host is unreachable.
|
void |
setConnectionTimeout(int timeout)
Sets the time, in milliseconds, to wait for connection establishments.
|
void |
setContentCharSet(String charSet)
Sets the character set used for HTTP content.
|
void |
setHttpsProtocolSocketFactory(org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory factory)
Sets the protocol socket factory used for the https scheme.
|
void |
setMaxConnectionsPerHost(int max)
Sets the maximum number of connections, per host, that the client will create.
|
void |
setMaxTotalConnections(int max)
Sets the maximum number of total connections the client will create.
|
void |
setPreemptiveAuthentication(boolean preemptive)
Sets whether authentication is performed preemptively.
|
void |
setProxyHost(String host)
Sets the host name of the HTTP proxy server through which connections will be made.
|
void |
setProxyPassword(String password)
Sets the password used to connect to the HTTP proxy server.
|
void |
setProxyPort(int port)
Sets the port of the HTTP proxy server through which connections will be made.
|
void |
setProxyUsername(String username)
Sets the username used to connect to the HTTP proxy server.
|
void |
setReceiveBufferSize(int size)
Sets the size of buffer, in bytes, used when sending content.
|
void |
setSendBufferSize(int size)
Sets the size of buffer, in bytes, used when sending content.
|
void |
setTcpNoDelay(boolean noDelay)
Sets whether to use TCP No Delay when sending data.
|
private String proxyHost
private int proxyPort
private String proxyUsername
private String proxyPassword
private boolean preemptiveAuthentication
private String contentCharSet
private int connectionTimeout
private int sendBufferSize
private int receiveBufferSize
private boolean tcpNoDelay
private int maxConnectionsPerHost
private int maxTotalConnectons
private int connectionRetryAttempts
private org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory httpsProtocolSocketFactory
public void resetDefaults()
public org.apache.commons.httpclient.HttpClient buildClient()
public String getProxyHost()
public void setProxyHost(String host)
host
- host name of the HTTP proxy server through which connections will be madepublic int getProxyPort()
public void setProxyPort(int port)
port
- port of the HTTP proxy server through which connections will be madepublic String getProxyUsername()
public void setProxyUsername(String username)
username
- username used to connect to the HTTP proxy serverpublic String getProxyPassword()
public void setProxyPassword(String password)
password
- password used to connect to the HTTP proxy serverpublic boolean isPreemptiveAuthentication()
false
.public void setPreemptiveAuthentication(boolean preemptive)
preemptive
- whether authentication is performed preemptivelypublic String getContentCharSet()
UTF-8
.public void setContentCharSet(String charSet)
charSet
- character set used for HTTP contentpublic int getConnectionTimeout()
public void setConnectionTimeout(int timeout)
timeout
- time, in milliseconds, to wait for connection establishmentspublic int getSendBufferSize()
public void setSendBufferSize(int size)
size
- size of buffer, in bytes, used when sending contentpublic int getReceiveBufferSize()
public void setReceiveBufferSize(int size)
size
- size of buffer, in bytes, used when sending contentpublic boolean isTcpNoDelay()
true
.public void setTcpNoDelay(boolean noDelay)
noDelay
- whether to use TCP No Delay when sending datapublic int getMaxConnectionsPerHost()
public void setMaxConnectionsPerHost(int max)
max
- maximum number of connections, per host, that the client will createpublic int getMaxTotalConnections()
public void setMaxTotalConnections(int max)
max
- maximum number of total connections the client will create, must be greater than zeropublic int getConnectionRetryAttempts()
public void setConnectionRetryAttempts(int attempts)
attempts
- number of times a connection will be tried if a host is unreachablepublic org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory getHttpsProtocolSocketFactory()
public void setHttpsProtocolSocketFactory(org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory factory)
factory
- the httpsProtocolSocketFactory to setCopyright © 1999-2013 JBoss by Red Hat. All Rights Reserved.