public final class ProxyUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ProxyUtil.ProxyServer
Information about a proxy server.
|
Modifier and Type | Method and Description |
---|---|
static Properties |
configureProxies(File propsFile)
Configure proxies based on the contents of specifed user preferences
file.
|
static void |
configureProxies(Preferences prefs)
Configure proxies based on the contents of specifed user preferences
object.
|
static String |
getProxySettings(Preferences prefs)
Returns which type of proxy configuration to use:
"none", "system" (default), "application".
|
static ProxyUtil.ProxyServer |
queryProxySelector(String protocol,
String host,
int port)
Returns which proxy server to use based on what is returned by the
default
ProxySelector . |
public static String getProxySettings(Preferences prefs)
prefs
- the user preferences. May be null
.null
if prefs is null
or if it does
not contain a "proxySettings
" entrypublic static Properties configureProxies(File propsFile)
configureProxies(Preferences)
public static void configureProxies(Preferences prefs)
This method sets most of the system properties described in Networking Properties, Proxies. It will at least set "java.net.useSystemProxies" to "true" or "false".
configureProxies(File)
public static ProxyUtil.ProxyServer queryProxySelector(String protocol, String host, int port)
ProxySelector
.
Note that the default proxy selector does enforce a set of system Properties related to proxy settings documented here: Networking Properties, Proxies.
protocol
- the protocol of the network connectionhost
- the hostname or address of the server to be connectedport
- the port number of the server to be connectednull
(do not use a
proxy server)