Top Description Inners Fields Constructors Methods
org.eclipse.jetty.client

public Class ProxyConfiguration

extends Object
Class Inheritance
Imports
java.net.URI, java.util.HashSet, .List, .Objects, .Set, org.eclipse.jetty.http.HttpScheme, org.eclipse.jetty.io.ClientConnectionFactory, org.eclipse.jetty.util.BlockingArrayQueue, .HostPort, org.eclipse.jetty.util.ssl.SslContextFactory

The configuration of the forward proxies to use with org.eclipse.jetty.client.HttpClient.

Applications add subclasses of Proxy to this configuration via, for example:

ProxyConfiguration proxyConfig = httpClient.getProxyConfiguration();
proxyConfig.addProxy(new HttpProxy(proxyHost, 8080));
See Also
HttpClient#getProxyConfiguration()

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class

Field Summary

Modifier and TypeField and Description
private final List<ProxyConfiguration.Proxy>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addProxy(ProxyConfiguration.Proxy
a proxy
proxy
)

Adds a proxy.

public List<ProxyConfiguration.Proxy>

Returns:

the forward proxies
getProxies
()

Returns an unmodifiable list of proxies added to this configuration.

public ProxyConfiguration.Proxy
match(Origin origin)

public boolean

Returns:

true if a match is found
removeProxy
(ProxyConfiguration.Proxy
a proxy
proxy
)

Removes a proxy.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

proxiesback to summary
private final List<ProxyConfiguration.Proxy> proxies

Constructor Detail

ProxyConfigurationback to summary
public ProxyConfiguration()

Method Detail

addProxyback to summary
public void addProxy(ProxyConfiguration.Proxy proxy)

Adds a proxy.

Parameters
proxy:ProxyConfiguration.Proxy

a proxy

Exceptions
NullPointerException:
if proxy is null
getProxiesback to summary
public List<ProxyConfiguration.Proxy> getProxies()

Returns an unmodifiable list of proxies added to this configuration.

Returns:List<ProxyConfiguration.Proxy>

the forward proxies

See Also
addProxy(Proxy)
matchback to summary
public ProxyConfiguration.Proxy match(Origin origin)
removeProxyback to summary
public boolean removeProxy(ProxyConfiguration.Proxy proxy)

Removes a proxy.

Parameters
proxy:ProxyConfiguration.Proxy

a proxy

Returns:boolean

true if a match is found

org.eclipse.jetty.client back to summary

public abstract Class ProxyConfiguration.Proxy

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.jetty.client.Socks4Proxy, org.eclipse.jetty.client.Socks5Proxy, org.eclipse.jetty.client.HttpProxy

Field Summary

Modifier and TypeField and Description
private final Set<String>
private final Set<String>
private final Origin
private final SslContextFactory.Client

Constructor Summary

AccessConstructor and Description
protected
Proxy(Origin.Address address, boolean secure, SslContextFactory.Client sslContextFactory, Origin.Protocol protocol)

protected
Proxy(Origin origin, SslContextFactory.Client sslContextFactory)

Method Summary

Modifier and TypeMethod and Description
public Origin.Address
getAddress()

Returns: the address of this proxy

public Set<String>
getExcludedAddresses()

Returns: the set of origins that must not be proxied.

public Set<String>
getIncludedAddresses()

Returns: the set of origins that must be proxied

public Origin
public Origin.Protocol
getProtocol()

Returns: the protocol spoken by this proxy

public SslContextFactory.Client
getSslContextFactory()

Returns: the optional SslContextFactory to use when connecting to proxies

public URI
getURI()

Returns: an URI representing this proxy, or null if no URI can represent this proxy

public boolean
isSecure()

Returns: whether the connection to the proxy must be secured via TLS

public boolean

Returns:

true if the origin must be proxied, false otherwise
matches
(Origin
the origin to test for proxying
origin
)

Matches the given origin with the included and excluded addresses, returning true if the given origin is to be proxied.

private boolean
matches(Origin.Address address, String pattern)

public abstract ClientConnectionFactory
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

excludedback to summary
private final Set<String> excluded
includedback to summary
private final Set<String> included
originback to summary
private final Origin origin
sslContextFactoryback to summary
private final SslContextFactory.Client sslContextFactory

Constructor Detail

Proxyback to summary
protected Proxy(Origin.Address address, boolean secure, SslContextFactory.Client sslContextFactory, Origin.Protocol protocol)
Proxyback to summary
protected Proxy(Origin origin, SslContextFactory.Client sslContextFactory)

Method Detail

getAddressback to summary
public Origin.Address getAddress()
Returns:Origin.Address

the address of this proxy

getExcludedAddressesback to summary
public Set<String> getExcludedAddresses()
Returns:Set<String>

the set of origins that must not be proxied.

See Also
matches(Origin), getIncludedAddresses()
getIncludedAddressesback to summary
public Set<String> getIncludedAddresses()
Returns:Set<String>

the set of origins that must be proxied

See Also
matches(Origin), getExcludedAddresses()
getOriginback to summary
public Origin getOrigin()
getProtocolback to summary
public Origin.Protocol getProtocol()
Returns:Origin.Protocol

the protocol spoken by this proxy

getSslContextFactoryback to summary
public SslContextFactory.Client getSslContextFactory()
Returns:SslContextFactory.Client

the optional SslContextFactory to use when connecting to proxies

getURIback to summary
public URI getURI()
Returns:URI

an URI representing this proxy, or null if no URI can represent this proxy

isSecureback to summary
public boolean isSecure()
Returns:boolean

whether the connection to the proxy must be secured via TLS

matchesback to summary
public boolean matches(Origin origin)

Matches the given origin with the included and excluded addresses, returning true if the given origin is to be proxied.

Parameters
origin:Origin

the origin to test for proxying

Returns:boolean

true if the origin must be proxied, false otherwise

matchesback to summary
private boolean matches(Origin.Address address, String pattern)
newClientConnectionFactoryback to summary
public abstract ClientConnectionFactory newClientConnectionFactory(ClientConnectionFactory connectionFactory)
Parameters
connectionFactory:ClientConnectionFactory

the nested ClientConnectionFactory

Returns:ClientConnectionFactory

a new ClientConnectionFactory for this Proxy

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override