public final class ProxyManager extends Object
ProxySettings,
SystemProxyConfirmationSupport| Modifier and Type | Field and Description |
|---|---|
static String |
ALWAYS_USE_SYSTEM_SETTINGS
Settings key for system proxy settings usage option.
|
protected static Authenticator |
authenticator
Custom proxy authenticator.
|
static String |
AUTO_SETTINGS_ON
Settings key for automated proxy settings option.
|
protected static boolean |
autoDetectionEnabled
Whether automatic proxy detection is enabled or not.
|
protected static boolean |
initialized
Whether manager is initialized or not.
|
static String |
PROXY_SETTINGS
Settings key for proxy settings.
|
protected static boolean |
proxySet
Proxy settings install flag.
|
static String |
SAVE_SETTINGS
Settings key for proxy settings save option.
|
static String |
SETTINGS_GROUP
Settings group key for proxy settings.
|
protected static SystemProxyConfirmationSupport |
systemProxyConfirmationSupport
System proxy settings confirmation dialog support.
|
| Constructor and Description |
|---|
ProxyManager() |
| Modifier and Type | Method and Description |
|---|---|
static Authenticator |
getAuthenticator()
Returns current proxy authenticator.
|
static ProxySettings |
getProxySettings()
Returns current proxy settings or default proxy settings if none installed.
|
protected static Proxy |
getSystemHttpProxy()
Returns system http proxy.
|
static SystemProxyConfirmationSupport |
getSystemProxyConfirmationSupport()
Returns system proxy settings confirmation dialog support.
|
static ProxySettings |
getSystemProxySettings()
Returns single system proxy settings object.
|
static URLConnection |
getURLConnection(URL url)
Opens URL connection with current proxy settings.
|
static void |
initialize()
Initializes manager if it wasn't already initialized.
|
static boolean |
isAlwaysUseSystemSettings()
Returns whether system proxy settings usage is enabled or not.
|
static boolean |
isAutoDetectionEnabled()
Returns whether automatic proxy detection is enabled or not.
|
static boolean |
isAutoSettingsInitialization()
Returns whether auto initialization of proxy settings is enabled or not.
|
static void |
setAlwaysUseSystemSettings(boolean useSystem)
Sets whether enable system proxy settings usage or not.
|
static void |
setAuthenticator(Authenticator authenticator)
Changes current proxy authenticator to the specified one.
|
static void |
setAutoDetectionEnabled(boolean enabled)
Sets whether automatic proxy detection is enabled or not.
|
static void |
setAutoSettingsInitialization(boolean enabled)
Sets whether enable auto initialization of proxy settings or not.
|
static void |
setEmptyProxySettings()
Installs empty proxy settings.
|
static void |
setProxySettings()
Installs saved or system proxy settings.
|
static void |
setProxySettings(ProxySettings settings)
Installs proxy settings with specified host, port and proxy login and password.
|
static void |
setProxySettings(ProxySettings settings,
boolean save)
Installs proxy settings with specified host, port and proxy login and password.
|
static void |
setProxySettings(String host,
String port)
Installs proxy settings with specified host and port.
|
static void |
setProxySettings(String host,
String port,
String login,
String password)
Installs proxy settings with specified host, port and proxy login and password.
|
static void |
setSystemProxyConfirmationSupport(SystemProxyConfirmationSupport support)
Sets system proxy settings confirmation dialog support.
|
static ProxySettings |
setSystemProxySettings()
Installs system proxy settings.
|
static void |
setupProxy(URLConnection urlConnection)
Installs current proxy settings to URL connection.
|
public static final String SETTINGS_GROUP
public static final String PROXY_SETTINGS
public static final String AUTO_SETTINGS_ON
public static final String ALWAYS_USE_SYSTEM_SETTINGS
public static final String SAVE_SETTINGS
protected static boolean autoDetectionEnabled
protected static Authenticator authenticator
protected static boolean proxySet
protected static SystemProxyConfirmationSupport systemProxyConfirmationSupport
protected static boolean initialized
public static void initialize()
public static boolean isAutoDetectionEnabled()
public static void setAutoDetectionEnabled(boolean enabled)
enabled - whether automatic proxy detection is enabled or notpublic static Authenticator getAuthenticator()
public static void setAuthenticator(Authenticator authenticator)
authenticator - new proxy authenticatorpublic static void setAutoSettingsInitialization(boolean enabled)
enabled - whether enable auto initialization of proxy settings or notpublic static boolean isAutoSettingsInitialization()
public static void setAlwaysUseSystemSettings(boolean useSystem)
useSystem - whether enable system proxy settings usage or notpublic static boolean isAlwaysUseSystemSettings()
public static ProxySettings getProxySettings()
public static void setProxySettings()
public static void setEmptyProxySettings()
public static ProxySettings setSystemProxySettings()
public static void setProxySettings(String host, String port)
host - proxy hostport - proxy portpublic static void setProxySettings(String host, String port, String login, String password)
host - proxy hostport - proxy portlogin - proxy loginpassword - proxy passwordpublic static void setProxySettings(ProxySettings settings)
settings - single proxy settings objectpublic static void setProxySettings(ProxySettings settings, boolean save)
settings - single proxy settings objectsave - whether save these settings or notpublic static URLConnection getURLConnection(URL url) throws IOException
url - url to connect toIOException - when connection failedpublic static void setupProxy(URLConnection urlConnection)
urlConnection - URL connection to modifypublic static ProxySettings getSystemProxySettings()
protected static Proxy getSystemHttpProxy()
public static SystemProxyConfirmationSupport getSystemProxyConfirmationSupport()
public static void setSystemProxyConfirmationSupport(SystemProxyConfirmationSupport support)
support - system proxy settings confirmation dialog supportCopyright © 2020. All rights reserved.