Package org.alfresco.httpclient
Class HttpClientFactory
- java.lang.Object
-
- org.alfresco.httpclient.HttpClientFactory
-
public class HttpClientFactory extends Object
A factory to create HttpClients and AlfrescoHttpClients based on the setting of the 'secureCommsType' property.- Since:
- 4.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHttpClientFactory.NonBlockingHttpParamsstatic classHttpClientFactory.NonBlockingHttpParamsFactoryAn extension of the DefaultHttpParamsFactory that uses a RRW lock pattern rather than full synchronization around the parameter CRUD - to avoid locking on many reads.static classHttpClientFactory.SecureCommsType
-
Constructor Summary
Constructors Constructor Description HttpClientFactory()HttpClientFactory(HttpClientFactory.SecureCommsType secureCommsType, SSLEncryptionParameters sslEncryptionParameters, KeyResourceLoader keyResourceLoader, KeyStoreParameters keyStoreParameters, MD5EncryptionParameters encryptionParameters, String host, int port, int sslPort, int maxTotalConnections, int maxHostConnections, int socketTimeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.commons.httpclient.HttpClientconstructHttpClient()protected AlfrescoHttpClientgetAlfrescoHttpClient()protected AlfrescoHttpClientgetAlfrescoHttpsClient()protected org.apache.commons.httpclient.HttpClientgetDefaultHttpClient()protected org.apache.commons.httpclient.HttpClientgetDefaultHttpClient(String httpHost, int httpPort)StringgetHost()org.apache.commons.httpclient.HttpClientgetHttpClient()org.apache.commons.httpclient.HttpClientgetHttpClient(String host, int port)protected org.apache.commons.httpclient.HttpClientgetHttpsClient()protected org.apache.commons.httpclient.HttpClientgetHttpsClient(String httpsHost, int httpsPort)intgetMaxHostConnections()intgetMaxTotalConnections()protected org.apache.commons.httpclient.HttpClientgetMD5HttpClient(String host, int port)intgetPort()AlfrescoHttpClientgetRepoClient(String host, int port)voidinit()booleanisSSL()voidsetConnectionTimeout(int connectionTimeout)Attempts to connect to a server will timeout after this period (millis).voidsetEncryptionParameters(MD5EncryptionParameters encryptionParameters)voidsetHost(String host)voidsetKeyResourceLoader(KeyResourceLoader keyResourceLoader)voidsetKeyStoreParameters(KeyStoreParameters keyStoreParameters)voidsetMaxHostConnections(int maxHostConnections)voidsetMaxTotalConnections(int maxTotalConnections)voidsetPort(int port)voidsetSecureCommsType(String type)voidsetSocketTimeout(Integer socketTimeout)Sets the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data.voidsetSSLEncryptionParameters(SSLEncryptionParameters sslEncryptionParameters)voidsetSslPort(int sslPort)
-
-
-
Constructor Detail
-
HttpClientFactory
public HttpClientFactory()
-
HttpClientFactory
public HttpClientFactory(HttpClientFactory.SecureCommsType secureCommsType, SSLEncryptionParameters sslEncryptionParameters, KeyResourceLoader keyResourceLoader, KeyStoreParameters keyStoreParameters, MD5EncryptionParameters encryptionParameters, String host, int port, int sslPort, int maxTotalConnections, int maxHostConnections, int socketTimeout)
-
-
Method Detail
-
init
public void init()
-
setHost
public void setHost(String host)
-
getHost
public String getHost()
-
setPort
public void setPort(int port)
-
getPort
public int getPort()
-
setSslPort
public void setSslPort(int sslPort)
-
isSSL
public boolean isSSL()
-
setSecureCommsType
public void setSecureCommsType(String type)
-
setSSLEncryptionParameters
public void setSSLEncryptionParameters(SSLEncryptionParameters sslEncryptionParameters)
-
setKeyStoreParameters
public void setKeyStoreParameters(KeyStoreParameters keyStoreParameters)
-
setEncryptionParameters
public void setEncryptionParameters(MD5EncryptionParameters encryptionParameters)
-
setKeyResourceLoader
public void setKeyResourceLoader(KeyResourceLoader keyResourceLoader)
-
getMaxTotalConnections
public int getMaxTotalConnections()
- Returns:
- the maxTotalConnections
-
setMaxTotalConnections
public void setMaxTotalConnections(int maxTotalConnections)
- Parameters:
maxTotalConnections- the maxTotalConnections to set
-
getMaxHostConnections
public int getMaxHostConnections()
- Returns:
- the maxHostConnections
-
setMaxHostConnections
public void setMaxHostConnections(int maxHostConnections)
- Parameters:
maxHostConnections- the maxHostConnections to set
-
setSocketTimeout
public void setSocketTimeout(Integer socketTimeout)
Sets the default socket timeout (SO_TIMEOUT) in milliseconds which is the timeout for waiting for data. A timeout value of zero is interpreted as an infinite timeout.- Parameters:
socketTimeout- Timeout in milliseconds
-
setConnectionTimeout
public void setConnectionTimeout(int connectionTimeout)
Attempts to connect to a server will timeout after this period (millis). Default is zero (the timeout is not used).- Parameters:
connectionTimeout- time in millis.
-
constructHttpClient
protected org.apache.commons.httpclient.HttpClient constructHttpClient()
-
getHttpsClient
protected org.apache.commons.httpclient.HttpClient getHttpsClient()
-
getHttpsClient
protected org.apache.commons.httpclient.HttpClient getHttpsClient(String httpsHost, int httpsPort)
-
getDefaultHttpClient
protected org.apache.commons.httpclient.HttpClient getDefaultHttpClient()
-
getDefaultHttpClient
protected org.apache.commons.httpclient.HttpClient getDefaultHttpClient(String httpHost, int httpPort)
-
getAlfrescoHttpsClient
protected AlfrescoHttpClient getAlfrescoHttpsClient()
-
getAlfrescoHttpClient
protected AlfrescoHttpClient getAlfrescoHttpClient()
-
getMD5HttpClient
protected org.apache.commons.httpclient.HttpClient getMD5HttpClient(String host, int port)
-
getRepoClient
public AlfrescoHttpClient getRepoClient(String host, int port)
-
getHttpClient
public org.apache.commons.httpclient.HttpClient getHttpClient()
-
getHttpClient
public org.apache.commons.httpclient.HttpClient getHttpClient(String host, int port)
-
-