public class GoogleNetHttpTransportUtilities for Google APIs based on NetHttpTransport.
Static Methods
newTrustedTransport()
public static NetHttpTransport newTrustedTransport()Returns a new instance of NetHttpTransport that uses GoogleUtils#getCertificateTrustStore() for the trusted certificates using com.google.api.client.http.javanet.NetHttpTransport.Builder#trustCertificates(KeyStore). If
GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is set to "true", and the default
client certificate key store from Utils#loadDefaultMtlsKeyStore() is not null, then the
transport uses the default client certificate and is mutual TLS.
This helper method doesn't provide for customization of the NetHttpTransport, such as the ability to specify a proxy. To do use, use com.google.api.client.http.javanet.NetHttpTransport.Builder, for example:
static HttpTransport newProxyTransport() throws GeneralSecurityException, IOException {
NetHttpTransport.Builder builder = new NetHttpTransport.Builder();
builder.trustCertificates(GoogleUtils.getCertificateTrustStore());
builder.setProxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 3128)));
return builder.build();
}
| Returns | |
|---|---|
| Type | Description |
com.google.api.client.http.javanet.NetHttpTransport |
|
| Exceptions | |
|---|---|
| Type | Description |
GeneralSecurityException |
|
IOException |
|
newTrustedTransport(MtlsProvider mtlsProvider)
public static NetHttpTransport newTrustedTransport(MtlsProvider mtlsProvider)Beta
Returns a new instance of NetHttpTransport that uses GoogleUtils#getCertificateTrustStore() for the trusted certificates using com.google.api.client.http.javanet.NetHttpTransport.Builder#trustCertificates(KeyStore).
mtlsProvider can be used to configure mutual TLS for the transport.
| Parameter | |
|---|---|
| Name | Description |
mtlsProvider |
MtlsProviderMtlsProvider to configure mutual TLS for the transport |
| Returns | |
|---|---|
| Type | Description |
com.google.api.client.http.javanet.NetHttpTransport |
|
| Exceptions | |
|---|---|
| Type | Description |
GeneralSecurityException |
|
IOException |
|