Class HttpTransportFactory


  • public class HttpTransportFactory
    extends Object
    Factory for creating HttpTransport types.
    • Constructor Detail

      • HttpTransportFactory

        public HttpTransportFactory()
    • Method Detail

      • createHttpTransport

        public static com.google.api.client.http.HttpTransport createHttpTransport()
                                                                            throws IOException
        Create an HttpTransport with socketKeepAlive true
        Returns:
        The resulting HttpTransport.
        Throws:
        IllegalArgumentException - If the proxy address is invalid.
        IOException - If there is an issue connecting to Google's Certification server.
      • createHttpTransport

        public static com.google.api.client.http.HttpTransport createHttpTransport​(@Nullable
                                                                                   String proxyAddress,
                                                                                   @Nullable
                                                                                   RedactedString proxyUsername,
                                                                                   @Nullable
                                                                                   RedactedString proxyPassword)
                                                                            throws IOException
        Create an HttpTransport based on a type class and an optional HTTP proxy.
        Parameters:
        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.
        Returns:
        The resulting HttpTransport.
        Throws:
        IllegalArgumentException - If the proxy address is invalid.
        IOException - If there is an issue connecting to Google's Certification server.
      • createHttpTransport

        public static com.google.api.client.http.HttpTransport createHttpTransport​(@Nullable
                                                                                   String proxyAddress,
                                                                                   @Nullable
                                                                                   RedactedString proxyUsername,
                                                                                   @Nullable
                                                                                   RedactedString proxyPassword,
                                                                                   @Nullable
                                                                                   Duration readTimeout)
                                                                            throws IOException
        Create an HttpTransport based on a type class, optional HTTP proxy and optional socket read timeout.
        Parameters:
        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.
        Returns:
        The resulting HttpTransport.
        Throws:
        IllegalArgumentException - If the proxy address is invalid.
        IOException - If there is an issue connecting to Google's Certification server.
      • createNetHttpTransport

        public static com.google.api.client.http.javanet.NetHttpTransport createNetHttpTransport​(@Nullable
                                                                                                 URI proxyUri,
                                                                                                 @Nullable
                                                                                                 PasswordAuthentication proxyAuth,
                                                                                                 @Nullable
                                                                                                 Duration readTimeout)
                                                                                          throws IOException,
                                                                                                 GeneralSecurityException
        Create an NetHttpTransport for calling Google APIs with an optional HTTP proxy.
        Parameters:
        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.
        Returns:
        The resulting HttpTransport.
        Throws:
        IOException - If there is an issue connecting to Google's certification server.
        GeneralSecurityException - If there is a security issue with the keystore.