public class GoogleNetHttpTransport
Utilities 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();
}
Type | Description |
com.google.api.client.http.javanet.NetHttpTransport |
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.
Name | Description |
mtlsProvider | MtlsProvider MtlsProvider to configure mutual TLS for the transport |
Type | Description |
com.google.api.client.http.javanet.NetHttpTransport |
Type | Description |
GeneralSecurityException | |
IOException |