Package net.sourceforge.jnlp.proxy
Class JNLPProxySelector
- java.lang.Object
-
- java.net.ProxySelector
-
- net.sourceforge.jnlp.proxy.JNLPProxySelector
-
- Direct Known Subclasses:
FirefoxProxySelector
public abstract class JNLPProxySelector extends java.net.ProxySelectorA ProxySelector specific to JNLPs. This proxy uses the deployment configuration to determine what to do.- See Also:
ProxySelector
-
-
Field Summary
Fields Modifier and Type Field Description private java.net.URLautoConfigUrlthe URL to the PAC fileprivate java.util.List<java.lang.String>bypassLista list of URLs that should be bypassed for proxy purposesprivate booleanbypassLocalwhether localhost should be bypassed for proxy purposesprivate static LoggerLOGprivate PacEvaluatorpacEvaluatorprivate java.lang.StringproxyFtpHostprivate intproxyFtpPortprivate java.lang.StringproxyHttpHostprivate intproxyHttpPortprivate java.lang.StringproxyHttpsHostprivate intproxyHttpsPortprivate java.lang.StringproxySocks4Hostprivate intproxySocks4Portprivate ProxyTypeproxyTypeThe proxy type.private booleansameProxywhether the http proxy should be used for https and ftp protocols as well
-
Constructor Summary
Constructors Constructor Description JNLPProxySelector(DeploymentConfiguration config)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidconnectFailed(java.net.URI uri, java.net.SocketAddress sa, java.io.IOException ioe)protected static java.util.List<java.net.Proxy>getFromArguments(java.net.URI uri, boolean sameProxy, boolean sameProxyIncludesSocket, java.lang.String proxyHttpsHost, int proxyHttpsPort, java.lang.String proxyHttpHost, int proxyHttpPort, java.lang.String proxyFtpHost, int proxyFtpPort, java.lang.String proxySocks4Host, int proxySocks4Port)Returns a list of proxies by using the argumentsprotected abstract java.util.List<java.net.Proxy>getFromBrowser(java.net.URI uri)Returns a list of proxies by querying the browserprivate java.util.List<java.net.Proxy>getFromConfiguration(java.net.URI uri)Returns a list of proxies by using the information in the deployment configurationprivate java.util.List<java.net.Proxy>getFromPAC(java.net.URI uri)Returns a list of proxies by using the Proxy Auto Config (PAC) file.private java.lang.StringgetHost(DeploymentConfiguration config, java.lang.String key)Uses the given key to get a host from the configurationprivate intgetPort(DeploymentConfiguration config, java.lang.String key)Uses the given key to get a port from the configurationprivate booleaninBypassList(java.net.URI uri)Returns true if the uri should be bypassed for proxy purposesjava.util.List<java.net.Proxy>select(java.net.URI uri)
-
-
-
Field Detail
-
LOG
private static final Logger LOG
-
pacEvaluator
private PacEvaluator pacEvaluator
-
autoConfigUrl
private java.net.URL autoConfigUrl
the URL to the PAC file
-
bypassLocal
private boolean bypassLocal
whether localhost should be bypassed for proxy purposes
-
proxyType
private final ProxyType proxyType
The proxy type. See PROXY_TYPE_* constants
-
proxyHttpHost
private final java.lang.String proxyHttpHost
-
proxyHttpPort
private final int proxyHttpPort
-
proxyHttpsHost
private final java.lang.String proxyHttpsHost
-
proxyHttpsPort
private final int proxyHttpsPort
-
proxyFtpHost
private final java.lang.String proxyFtpHost
-
proxyFtpPort
private final int proxyFtpPort
-
proxySocks4Host
private final java.lang.String proxySocks4Host
-
proxySocks4Port
private final int proxySocks4Port
-
bypassList
private final java.util.List<java.lang.String> bypassList
a list of URLs that should be bypassed for proxy purposes
-
sameProxy
private final boolean sameProxy
whether the http proxy should be used for https and ftp protocols as well
-
-
Constructor Detail
-
JNLPProxySelector
public JNLPProxySelector(DeploymentConfiguration config)
-
-
Method Detail
-
getHost
private java.lang.String getHost(DeploymentConfiguration config, java.lang.String key)
Uses the given key to get a host from the configuration
-
getPort
private int getPort(DeploymentConfiguration config, java.lang.String key)
Uses the given key to get a port from the configuration
-
connectFailed
public void connectFailed(java.net.URI uri, java.net.SocketAddress sa, java.io.IOException ioe)- Specified by:
connectFailedin classjava.net.ProxySelector
-
select
public java.util.List<java.net.Proxy> select(java.net.URI uri)
- Specified by:
selectin classjava.net.ProxySelector- Returns:
- list of proxies on URI
-
inBypassList
private boolean inBypassList(java.net.URI uri)
Returns true if the uri should be bypassed for proxy purposes
-
getFromConfiguration
private java.util.List<java.net.Proxy> getFromConfiguration(java.net.URI uri)
Returns a list of proxies by using the information in the deployment configuration- Parameters:
uri- uri to read- Returns:
- a List of Proxy objects
-
getFromArguments
protected static java.util.List<java.net.Proxy> getFromArguments(java.net.URI uri, boolean sameProxy, boolean sameProxyIncludesSocket, java.lang.String proxyHttpsHost, int proxyHttpsPort, java.lang.String proxyHttpHost, int proxyHttpPort, java.lang.String proxyFtpHost, int proxyFtpPort, java.lang.String proxySocks4Host, int proxySocks4Port)Returns a list of proxies by using the arguments- Parameters:
uri- name and code says it allsameProxy- name and code says it allsameProxyIncludesSocket- name and code says it allproxyHttpsHost- name and code says it allproxyHttpsPort- name and code says it allproxyHttpHost- name and code says it allproxyHttpPort- name and code says it allproxyFtpHost- name and code says it allproxyFtpPort- name and code says it allproxySocks4Host- name and code says it allproxySocks4Port- name and code says it all- Returns:
- a List of Proxy objects
-
getFromPAC
private java.util.List<java.net.Proxy> getFromPAC(java.net.URI uri)
Returns a list of proxies by using the Proxy Auto Config (PAC) file. See http://en.wikipedia.org/wiki/Proxy_auto-config#The_PAC_file for more information.- Parameters:
uri- uri to PAC- Returns:
- a List of valid Proxy objects
-
getFromBrowser
protected abstract java.util.List<java.net.Proxy> getFromBrowser(java.net.URI uri)
Returns a list of proxies by querying the browser- Parameters:
uri- the uri to get proxies for- Returns:
- a list of proxies
-
-