public class HttpTransportFactory extends Object
Modifier and Type | Class and Description |
---|---|
static class |
HttpTransportFactory.HttpTransportType
Types of HttpTransports the factory can create.
|
Modifier and Type | Field and Description |
---|---|
static HttpTransportFactory.HttpTransportType |
DEFAULT_TRANSPORT_TYPE |
Constructor and Description |
---|
HttpTransportFactory() |
Modifier and Type | Method and Description |
---|---|
static com.google.api.client.http.apache.v2.ApacheHttpTransport |
createApacheHttpTransport(URI proxyUri,
org.apache.http.auth.Credentials proxyCredentials)
Create an
ApacheHttpTransport for calling Google APIs with an optional HTTP proxy. |
static com.google.api.client.http.HttpTransport |
createHttpTransport(HttpTransportFactory.HttpTransportType type)
Create an
HttpTransport with socketKeepAlive true |
static com.google.api.client.http.HttpTransport |
createHttpTransport(HttpTransportFactory.HttpTransportType type,
String proxyAddress,
RedactedString proxyUsername,
RedactedString proxyPassword)
Create an
HttpTransport based on a type class and an optional HTTP proxy. |
static com.google.api.client.http.HttpTransport |
createHttpTransport(HttpTransportFactory.HttpTransportType type,
String proxyAddress,
RedactedString proxyUsername,
RedactedString proxyPassword,
Duration readTimeout)
Create an
HttpTransport based on a type class, optional HTTP proxy and optional socket
read timeout. |
static com.google.api.client.http.javanet.NetHttpTransport |
createNetHttpTransport(URI proxyUri,
PasswordAuthentication proxyAuth,
Duration readTimeout)
Create an
NetHttpTransport for calling Google APIs with an optional HTTP proxy. |
public static final HttpTransportFactory.HttpTransportType DEFAULT_TRANSPORT_TYPE
public static com.google.api.client.http.HttpTransport createHttpTransport(HttpTransportFactory.HttpTransportType type) throws IOException
HttpTransport
with socketKeepAlive truetype
- The type of HttpTransport to use.IllegalArgumentException
- If the proxy address is invalid.IOException
- If there is an issue connecting to Google's Certification server.public static com.google.api.client.http.HttpTransport createHttpTransport(HttpTransportFactory.HttpTransportType type, @Nullable String proxyAddress, @Nullable RedactedString proxyUsername, @Nullable RedactedString proxyPassword) throws IOException
HttpTransport
based on a type class and an optional HTTP proxy.type
- The type of HttpTransport to use.proxyAddress
- The HTTP proxy to use with the transport. Of the form hostname:port. If
empty no proxy will be used.proxyUsername
- The HTTP proxy username to use with the transport. If empty no proxy
username will be used.proxyPassword
- The HTTP proxy password to use with the transport. If empty no proxy
password will be used.IllegalArgumentException
- If the proxy address is invalid.IOException
- If there is an issue connecting to Google's Certification server.public static com.google.api.client.http.HttpTransport createHttpTransport(HttpTransportFactory.HttpTransportType type, @Nullable String proxyAddress, @Nullable RedactedString proxyUsername, @Nullable RedactedString proxyPassword, @Nullable Duration readTimeout) throws IOException
HttpTransport
based on a type class, optional HTTP proxy and optional socket
read timeout.type
- The type of HttpTransport to use.proxyAddress
- The HTTP proxy to use with the transport. Of the form hostname:port. If
empty no proxy will be used.proxyUsername
- The HTTP proxy username to use with the transport. If empty no proxy
username will be used.proxyPassword
- The HTTP proxy password to use with the transport. If empty no proxy
password will be used.readTimeout
- The socket read timeout to apply immediately on all HTTP requests. If empty,
no socket read timeout will be applied.IllegalArgumentException
- If the proxy address is invalid.IOException
- If there is an issue connecting to Google's Certification server.public static com.google.api.client.http.apache.v2.ApacheHttpTransport createApacheHttpTransport(@Nullable URI proxyUri, @Nullable org.apache.http.auth.Credentials proxyCredentials) throws IOException, GeneralSecurityException
ApacheHttpTransport
for calling Google APIs with an optional HTTP proxy.proxyUri
- Optional HTTP proxy URI to use with the transport.proxyCredentials
- Optional HTTP proxy credentials to authenticate with the transport
proxy.IOException
- If there is an issue connecting to Google's certification server.GeneralSecurityException
- If there is a security issue with the keystore.public static com.google.api.client.http.javanet.NetHttpTransport createNetHttpTransport(@Nullable URI proxyUri, @Nullable PasswordAuthentication proxyAuth, @Nullable Duration readTimeout) throws IOException, GeneralSecurityException
NetHttpTransport
for calling Google APIs with an optional HTTP proxy.proxyUri
- Optional HTTP proxy URI to use with the transport.proxyAuth
- Optional HTTP proxy credentials to authenticate with the transport proxy.readTimeout
- Optional socket read timeout to apply immediately on all HTTP requests.IOException
- If there is an issue connecting to Google's certification server.GeneralSecurityException
- If there is a security issue with the keystore.Copyright © 2023. All rights reserved.