Class URLConnectionFactory

java.lang.Object
org.apache.hadoop.hdfs.web.URLConnectionFactory

@LimitedPrivate("HDFS") @Unstable public class URLConnectionFactory extends Object
Utilities for handling URLs
  • Field Details

    • DEFAULT_SOCKET_TIMEOUT

      public static final int DEFAULT_SOCKET_TIMEOUT
      Timeout for socket connects and reads
      See Also:
    • DEFAULT_SYSTEM_CONNECTION_FACTORY

      public static final URLConnectionFactory DEFAULT_SYSTEM_CONNECTION_FACTORY
      The URLConnectionFactory that sets the default timeout and it only trusts Java's SSL certificates.
  • Method Details

    • newDefaultURLConnectionFactory

      public static URLConnectionFactory newDefaultURLConnectionFactory(org.apache.hadoop.conf.Configuration conf)
      Construct a new URLConnectionFactory based on the configuration. It will try to load SSL certificates when it is specified.
    • newDefaultURLConnectionFactory

      public static URLConnectionFactory newDefaultURLConnectionFactory(int connectTimeout, int readTimeout, org.apache.hadoop.conf.Configuration conf)
      Construct a new URLConnectionFactory based on the configuration. It will hornor connecTimeout and readTimeout when they are specified.
    • newOAuth2URLConnectionFactory

      public static URLConnectionFactory newOAuth2URLConnectionFactory(int connectTimeout, int readTimeout, org.apache.hadoop.conf.Configuration conf) throws IOException
      Construct a new URLConnectionFactory that supports OAut-based connections. It will also try to load the SSL configuration when they are specified.
      Throws:
      IOException
    • openConnection

      public URLConnection openConnection(URL url) throws IOException
      Opens a url with read and connect timeouts
      Parameters:
      url - to open
      Returns:
      URLConnection
      Throws:
      IOException
    • openConnection

      public URLConnection openConnection(URL url, boolean isSpnego) throws IOException, org.apache.hadoop.security.authentication.client.AuthenticationException
      Opens a url with read and connect timeouts
      Parameters:
      url - URL to open
      isSpnego - whether the url should be authenticated via SPNEGO
      Returns:
      URLConnection
      Throws:
      IOException
      org.apache.hadoop.security.authentication.client.AuthenticationException
    • destroy

      public void destroy()