public static final class ApacheHttpTransport.Builder extends Object
ApacheHttpTransport.
Implementation is not thread-safe.
| Constructor and Description |
|---|
ApacheHttpTransport.Builder() |
| Modifier and Type | Method and Description |
|---|---|
ApacheHttpTransport |
build()
Returns a new instance of
ApacheHttpTransport based on the options. |
ApacheHttpTransport.Builder |
doNotValidateCertificate()
Disables validating server SSL certificates by setting the SSL socket factory using
SslUtils.trustAllSSLContext() for the SSL context and
SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER for the host name verifier. |
org.apache.http.params.HttpParams |
getHttpParams()
Returns the HTTP parameters.
|
org.apache.http.conn.ssl.SSLSocketFactory |
getSSLSocketFactory()
Returns the SSL socket factory (
SSLSocketFactory.getSocketFactory() by default). |
ApacheHttpTransport.Builder |
setProxy(org.apache.http.HttpHost proxy)
Sets the HTTP proxy to use
DefaultHttpRoutePlanner or null to use
setProxySelector(ProxySelector) with ProxySelector.getDefault(). |
ApacheHttpTransport.Builder |
setProxySelector(ProxySelector proxySelector)
Sets the HTTP proxy selector to use
ProxySelectorRoutePlanner or null for
DefaultHttpRoutePlanner. |
ApacheHttpTransport.Builder |
setSocketFactory(org.apache.http.conn.ssl.SSLSocketFactory socketFactory)
Sets the SSL socket factory (
SSLSocketFactory.getSocketFactory() by default). |
public ApacheHttpTransport.Builder setProxy(org.apache.http.HttpHost proxy)
DefaultHttpRoutePlanner or null to use
setProxySelector(ProxySelector) with ProxySelector.getDefault().
By default it is null, which uses the proxy settings from system
properties.
For example:
setProxy(new HttpHost("127.0.0.1", 8080))
public ApacheHttpTransport.Builder setProxySelector(ProxySelector proxySelector)
ProxySelectorRoutePlanner or null for
DefaultHttpRoutePlanner.
By default it is ProxySelector.getDefault() which uses the proxy settings from system
properties.
public ApacheHttpTransport.Builder doNotValidateCertificate() throws GeneralSecurityException
SslUtils.trustAllSSLContext() for the SSL context and
SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER for the host name verifier.
Be careful! Disabling certificate validation is dangerous and should only be done in testing environments.
GeneralSecurityExceptionpublic ApacheHttpTransport.Builder setSocketFactory(org.apache.http.conn.ssl.SSLSocketFactory socketFactory)
SSLSocketFactory.getSocketFactory() by default).public org.apache.http.conn.ssl.SSLSocketFactory getSSLSocketFactory()
SSLSocketFactory.getSocketFactory() by default).public org.apache.http.params.HttpParams getHttpParams()
public ApacheHttpTransport build()
ApacheHttpTransport based on the options.Copyright © 2011-2012 Google. All Rights Reserved.