Package org.apache.hadoop.hdfs.web
Class URLConnectionFactory
java.lang.Object
org.apache.hadoop.hdfs.web.URLConnectionFactory
Utilities for handling URLs
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intTimeout for socket connects and readsstatic final URLConnectionFactoryThe URLConnectionFactory that sets the default timeout and it only trusts Java's SSL certificates. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()static URLConnectionFactorynewDefaultURLConnectionFactory(int connectTimeout, int readTimeout, org.apache.hadoop.conf.Configuration conf) Construct a new URLConnectionFactory based on the configuration.static URLConnectionFactorynewDefaultURLConnectionFactory(org.apache.hadoop.conf.Configuration conf) Construct a new URLConnectionFactory based on the configuration.static URLConnectionFactorynewOAuth2URLConnectionFactory(int connectTimeout, int readTimeout, org.apache.hadoop.conf.Configuration conf) Construct a new URLConnectionFactory that supports OAut-based connections.openConnection(URL url) Opens a url with read and connect timeoutsopenConnection(URL url, boolean isSpnego) Opens a url with read and connect timeouts
-
Field Details
-
DEFAULT_SOCKET_TIMEOUT
public static final int DEFAULT_SOCKET_TIMEOUTTimeout for socket connects and reads- See Also:
-
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
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 openisSpnego- whether the url should be authenticated via SPNEGO- Returns:
- URLConnection
- Throws:
IOExceptionorg.apache.hadoop.security.authentication.client.AuthenticationException
-
destroy
public void destroy()
-