Eclipse Platform
Release 3.3

org.eclipse.core.net.proxy
Interface IProxyService


public interface IProxyService

Manages the proxy data and related information. The proxy service is registered as an OSGi service. Clients can obtain an instance of the service from their bundle context or from a service tracker.

This interface is not intended to be implemented by clients.

Since:
1.0

Method Summary
 void addProxyChangeListener(IProxyChangeListener listener)
          Register a listener that will be notified when proxy related information changes.
 String[] getNonProxiedHosts()
          Return the list of hosts for which non proxy should be used.
 IProxyData[] getProxyData()
          Return the list of know proxy types and their settings.
 IProxyData getProxyData(String type)
          Return the proxy data for the proxy of the given type or null if the proxy type is not known by this service.
 IProxyData[] getProxyDataForHost(String host)
          Return the list of known proxy types and their settings for the given host.
 IProxyData getProxyDataForHost(String host, String type)
          Return the proxy data for the proxy of the given type or null if the proxy type is not known by this service, the proxy data is empty for that type or the host is in the non-proxied host list.
 boolean isProxiesEnabled()
          Return whether proxy support should be enabled.
 void removeProxyChangeListener(IProxyChangeListener listener)
          Remove a listener.
 void setNonProxiedHosts(String[] hosts)
          Set the list of hosts for which non proxy should be used.
 void setProxiesEnabled(boolean enabled)
          Set whether proxy support should be enabled.
 void setProxyData(IProxyData[] proxies)
          Set the information associated with known proxy types.
 

Method Detail

setProxiesEnabled

public void setProxiesEnabled(boolean enabled)
Set whether proxy support should be enabled. The current proxy settings are still kept so clients should check the enablement using isProxiesEnabled() before calling the getProxyData() or getProxyData(String) method. However, the getProxyDataForHost(String) and getProxyDataForHost(String, String) method will check the enablement and only return data if the service is enabled.

Parameters:
enabled - whether proxy support should be enabled

isProxiesEnabled

public boolean isProxiesEnabled()
Return whether proxy support should be enabled. When disabled, all connections will be direct.

Returns:
whether proxy support should be enabled

getProxyData

public IProxyData[] getProxyData()
Return the list of know proxy types and their settings. Some of the returned proxy types may not be enabled (i.e, their hosts may be null.

Returns:
the list of know proxy types and their settings

getProxyDataForHost

public IProxyData[] getProxyDataForHost(String host)
Return the list of known proxy types and their settings for the given host. If proxies are disabled or if the host matches any entries in the non-proxied hosts lists or if a matching proxy type has no data, then an empty array is returned.

Parameters:
host - the host for which a connection is desired
Returns:
the list of known proxy types and their settings for the given host

getProxyData

public IProxyData getProxyData(String type)
Return the proxy data for the proxy of the given type or null if the proxy type is not known by this service.

Parameters:
type - the proxy type
Returns:
the proxy data for the proxy of the given type or null
See Also:
IProxyData.HTTP_PROXY_TYPE, IProxyData.HTTPS_PROXY_TYPE, IProxyData.SOCKS_PROXY_TYPE

getProxyDataForHost

public IProxyData getProxyDataForHost(String host,
                                      String type)
Return the proxy data for the proxy of the given type or null if the proxy type is not known by this service, the proxy data is empty for that type or the host is in the non-proxied host list.

Parameters:
host - the host for which a connection is desired
type - the proxy type
Returns:
the proxy data for the proxy of the given type or null
See Also:
IProxyData.HTTP_PROXY_TYPE, IProxyData.HTTPS_PROXY_TYPE, IProxyData.SOCKS_PROXY_TYPE

setProxyData

public void setProxyData(IProxyData[] proxies)
                  throws CoreException
Set the information associated with known proxy types. If an unknown type is provided, it will be ignored. Any known types that are not present in the list of the provided proxy data will be unaffected.

Parameters:
proxies - the proxy data whose information is to be set.
Throws:
CoreException - if the proxy could not be set

getNonProxiedHosts

public String[] getNonProxiedHosts()
Return the list of hosts for which non proxy should be used. The values returned from this method should only be used for displaying the non-proxed hosts list. Clients that which to make a connection and need to determine whether to use a proxy or not shoudl call either getProxyDataForHost(String) or getProxyDataForHost(String, String).

Returns:
the list of hosts for which non proxy should be used.
See Also:
getProxyDataForHost(String), getProxyDataForHost(String, String)

setNonProxiedHosts

public void setNonProxiedHosts(String[] hosts)
                        throws CoreException
Set the list of hosts for which non proxy should be used.

Parameters:
hosts - the list of hosts for which non proxy should be used.
Throws:
CoreException - if the non-proxied host list could not be set

addProxyChangeListener

public void addProxyChangeListener(IProxyChangeListener listener)
Register a listener that will be notified when proxy related information changes. Adding a listener that is already registered has no effect.

Parameters:
listener - a change listener

removeProxyChangeListener

public void removeProxyChangeListener(IProxyChangeListener listener)
Remove a listener. Removing a listener that is not registered has no effect.

Parameters:
listener - a change listener

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.