|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.deegree.commons.utils.ProxyUtils
public final class ProxyUtils
Utility class for accessing and modifying the VM's proxy configuration and for opening URL connections that respect proxy configurations which require authentication.
Please note that Java's proxy configuration is VM-global: there is a set of system properties (proxyHost, proxyPort,
etc.) that determines the behaviour of network-related classes (e.g. in java.net
). This makes sense, as
the proxy configuration is usually defined by the network environment of the physical machine.
Constructor Summary | |
---|---|
ProxyUtils()
|
Method Summary | |
---|---|
static java.lang.String |
getFtpNonProxyHosts(boolean considerBaseConfig)
|
static java.lang.String |
getFtpProxyHost(boolean considerBaseConfig)
|
static java.lang.String |
getFtpProxyPassword(boolean considerBaseConfig)
|
static java.lang.String |
getFtpProxyPort(boolean considerBaseConfig)
|
static java.lang.String |
getFtpProxyUser(boolean considerBaseConfig)
|
static java.lang.String |
getHttpNonProxyHosts(boolean considerBaseConfig)
|
static java.lang.String |
getHttpProxyHost(boolean considerBaseConfig)
|
static java.lang.String |
getHttpProxyPassword(boolean considerBaseConfig)
|
static java.lang.String |
getHttpProxyPort(boolean considerBaseConfig)
|
static java.lang.String |
getHttpProxyUser(boolean considerBaseConfig)
|
static java.lang.String |
getNonProxyHosts()
|
static java.lang.String |
getProxyHost()
|
static java.lang.String |
getProxyPassword()
|
static java.lang.String |
getProxyPort()
|
static java.lang.String |
getProxyUser()
|
static void |
logProxyConfiguration(org.slf4j.Logger log)
|
static java.net.URLConnection |
openURLConnection(java.net.URL url)
This method should be used everywhere instead of URL.openConnection() , as it copes with proxies that
require user authentication. |
static java.net.URLConnection |
openURLConnection(java.net.URL url,
java.lang.String user,
java.lang.String pass)
This method should be used everywhere instead of URL.openConnection() , as it copes with proxies that
require user authentication. |
static void |
setupProxyParameters(java.io.File proxyConfigFile)
Sets/augments the VM's proxy configuration. |
static void |
setupProxyParameters(ProxyConfiguration config)
Sets/augments the VM's proxy configuration. |
static void |
setupProxyParameters(java.lang.String proxyHost,
java.lang.String httpProxyHost,
java.lang.String ftpProxyHost,
int proxyPort,
int httpProxyPort,
int ftpProxyPort,
java.lang.String proxyUser,
java.lang.String httpProxyUser,
java.lang.String ftpProxyUser,
java.lang.String proxyPassword,
java.lang.String httpProxyPassword,
java.lang.String ftpProxyPassword,
java.lang.String nonProxyHosts,
java.lang.String httpNonProxyHosts,
java.lang.String ftpNonProxyHosts,
boolean override)
Sets/augments the VM's proxy configuration. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProxyUtils()
Method Detail |
---|
public static void setupProxyParameters(java.io.File proxyConfigFile) throws java.lang.IllegalArgumentException
proxyConfigFile
-
java.lang.IllegalArgumentException
public static void setupProxyParameters(ProxyConfiguration config)
config
- public static void setupProxyParameters(java.lang.String proxyHost, java.lang.String httpProxyHost, java.lang.String ftpProxyHost, int proxyPort, int httpProxyPort, int ftpProxyPort, java.lang.String proxyUser, java.lang.String httpProxyUser, java.lang.String ftpProxyUser, java.lang.String proxyPassword, java.lang.String httpProxyPassword, java.lang.String ftpProxyPassword, java.lang.String nonProxyHosts, java.lang.String httpNonProxyHosts, java.lang.String ftpNonProxyHosts, boolean override)
proxyHost
- httpProxyHost
- ftpProxyHost
- proxyPort
- httpProxyPort
- ftpProxyPort
- proxyUser
- httpProxyUser
- ftpProxyUser
- proxyPassword
- httpProxyPassword
- ftpProxyPassword
- nonProxyHosts
- httpNonProxyHosts
- ftpNonProxyHosts
- override
- public static java.net.URLConnection openURLConnection(java.net.URL url) throws java.io.IOException
URL.openConnection()
, as it copes with proxies that
require user authentication. This method will retrieve the configured password and user name.
url
-
java.io.IOException
public static java.net.URLConnection openURLConnection(java.net.URL url, java.lang.String user, java.lang.String pass) throws java.io.IOException
URL.openConnection()
, as it copes with proxies that
require user authentication.
url
- user
- pass
-
java.io.IOException
public static java.lang.String getProxyHost()
public static java.lang.String getHttpProxyHost(boolean considerBaseConfig)
public static java.lang.String getFtpProxyHost(boolean considerBaseConfig)
public static java.lang.String getProxyPort()
public static java.lang.String getHttpProxyPort(boolean considerBaseConfig)
public static java.lang.String getFtpProxyPort(boolean considerBaseConfig)
public static java.lang.String getProxyUser()
public static java.lang.String getHttpProxyUser(boolean considerBaseConfig)
public static java.lang.String getFtpProxyUser(boolean considerBaseConfig)
public static java.lang.String getProxyPassword()
public static java.lang.String getHttpProxyPassword(boolean considerBaseConfig)
public static java.lang.String getFtpProxyPassword(boolean considerBaseConfig)
public static java.lang.String getNonProxyHosts()
public static java.lang.String getHttpNonProxyHosts(boolean considerBaseConfig)
public static java.lang.String getFtpNonProxyHosts(boolean considerBaseConfig)
public static void logProxyConfiguration(org.slf4j.Logger log)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |