public final class URLConnectionFactory extends Object
| Constructor and Description |
|---|
URLConnectionFactory(Settings settings)
Private constructor for this factory.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBasicAuthentication(HttpURLConnection conn,
String userKey,
String passwordKey)
Adds a basic authentication header if the values in the settings are not
null.
|
HttpURLConnection |
createHttpURLConnection(URL url)
Utility method to create an HttpURLConnection.
|
HttpURLConnection |
createHttpURLConnection(URL url,
boolean proxy)
Utility method to create an HttpURLConnection.
|
public URLConnectionFactory(Settings settings)
settings - reference to the configured settingspublic HttpURLConnection createHttpURLConnection(URL url) throws URLConnectionFailureException
url - the URL to connect toURLConnectionFailureException - thrown if there is an exceptionpublic void addBasicAuthentication(HttpURLConnection conn, String userKey, String passwordKey)
conn - the connection to add the basic auth headeruserKey - the settings key for the usernamepasswordKey - the settings key for the passwordpublic HttpURLConnection createHttpURLConnection(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–2020 OWASP. All rights reserved.