public class GoogleNetHttpTransport extends Object
NetHttpTransport.| Modifier and Type | Method and Description |
|---|---|
static NetHttpTransport |
newTrustedTransport()
Returns a new instance of
NetHttpTransport that uses GoogleUtils.getCertificateTrustStore() for the trusted certificates using NetHttpTransport.Builder.trustCertificates(KeyStore). |
static NetHttpTransport |
newTrustedTransport(MtlsProvider mtlsProvider)
Beta Returns a new instance of NetHttpTransport that uses GoogleUtils.getCertificateTrustStore() for the trusted certificates using NetHttpTransport.Builder.trustCertificates(KeyStore). |
public static NetHttpTransport newTrustedTransport() throws GeneralSecurityException, IOException
NetHttpTransport that uses GoogleUtils.getCertificateTrustStore() for the trusted certificates using 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 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();
}
GeneralSecurityExceptionIOException@Beta public static NetHttpTransport newTrustedTransport(MtlsProvider mtlsProvider) throws GeneralSecurityException, IOException
Beta NetHttpTransport that uses GoogleUtils.getCertificateTrustStore() for the trusted certificates using NetHttpTransport.Builder.trustCertificates(KeyStore).
mtlsProvider can be used to configure mutual TLS for the transport.mtlsProvider - MtlsProvider to configure mutual TLS for the transportGeneralSecurityExceptionIOExceptionCopyright © 2010–2022 Google. All rights reserved.