public final class URLConnectionFactory
extends java.lang.Object
| Constructor and Description |
|---|
URLConnectionFactory(Settings settings)
Private constructor for this factory.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBasicAuthentication(java.net.HttpURLConnection conn,
java.lang.String userKey,
java.lang.String passwordKey)
Adds a basic authentication header if the values in the settings are not
null.
|
java.net.HttpURLConnection |
createHttpURLConnection(java.net.URL url)
Utility method to create an HttpURLConnection.
|
java.net.HttpURLConnection |
createHttpURLConnection(java.net.URL url,
boolean proxy)
Utility method to create an HttpURLConnection.
|
public URLConnectionFactory(Settings settings)
settings - reference to the configured settingspublic java.net.HttpURLConnection createHttpURLConnection(java.net.URL url)
throws URLConnectionFailureException
url - the URL to connect toURLConnectionFailureException - thrown if there is an exceptionpublic void addBasicAuthentication(java.net.HttpURLConnection conn,
java.lang.String userKey,
java.lang.String passwordKey)
conn - the connection to add the basic auth headeruserKey - the settings key for the usernamepasswordKey - the settings key for the passwordpublic java.net.HttpURLConnection createHttpURLConnection(java.net.URL url,
boolean proxy)
throws URLConnectionFailureException
url - the URL to connect toproxy - whether to use the proxy (if configured)URLConnectionFailureException - thrown if there is an exceptionCopyright© 2012-21 Jeremy Long. All Rights Reserved.