Class HttpProxy
Client-side proxy configuration for HTTP proxying, as specified by RFC 9110.
By default the communication between client and proxy happens using the HTTP/1.1 protocol, but it may be configured to use also other HTTP protocol versions, such as HTTP/2.
-
Constructor Summary
ConstructorDescriptionCreates a new instance with the given HTTP proxy host and port.HttpProxy
(Origin.Address address, boolean secure) Creates a new instance with the given HTTP proxy address.HttpProxy
(Origin.Address address, boolean secure, Origin.Protocol protocol) Creates a new instance with the given HTTP proxy address and protocol.HttpProxy
(Origin.Address address, SslContextFactory.Client sslContextFactory) Creates a new instance with the given HTTP proxy address and TLS configuration.HttpProxy
(Origin.Address address, SslContextFactory.Client sslContextFactory, Origin.Protocol protocol) Creates a new instance with the given HTTP proxy address, TLS configuration and protocol.HttpProxy
(Origin origin, SslContextFactory.Client sslContextFactory) Creates a new instance with the given HTTP proxyOrigin
and TLS configuration. -
Method Summary
Modifier and TypeMethodDescriptiongetURI()
newClientConnectionFactory
(ClientConnectionFactory connectionFactory) boolean
requiresTunnel
(Origin serverOrigin) Methods inherited from class org.eclipse.jetty.client.ProxyConfiguration.Proxy
getAddress, getExcludedAddresses, getIncludedAddresses, getOrigin, getProtocol, getSslContextFactory, isSecure, matches, toString
-
Constructor Details
-
HttpProxy
Creates a new instance with the given HTTP proxy host and port.
- Parameters:
host
- the HTTP proxy host nameport
- the HTTP proxy port
-
HttpProxy
Creates a new instance with the given HTTP proxy address.
When
secure=true
the communication between the client and the proxy will be encrypted (using this proxyProxyConfiguration.Proxy.getSslContextFactory()
which typically defaults to that ofHttpClient
.- Parameters:
address
- the HTTP proxy address (host and port)secure
- whether the communication between the client and the HTTP proxy should be secure
-
HttpProxy
Creates a new instance with the given HTTP proxy address and protocol.
- Parameters:
address
- the HTTP proxy address (host and port)secure
- whether the communication between the client and the HTTP proxy should be secureprotocol
- the protocol to use to communicate with the HTTP proxy
-
HttpProxy
Creates a new instance with the given HTTP proxy address and TLS configuration.
The
SslContextFactory
could have a different configuration from the one configured inHttpClient
, and it is used to communicate with the HTTP proxy only (not to communicate with the servers).- Parameters:
address
- the HTTP proxy address (host and port)sslContextFactory
- theSslContextFactory.Client
to use to communicate with the HTTP proxy
-
HttpProxy
public HttpProxy(Origin.Address address, SslContextFactory.Client sslContextFactory, Origin.Protocol protocol) Creates a new instance with the given HTTP proxy address, TLS configuration and protocol.
The
SslContextFactory
could have a different configuration from the one configured inHttpClient
and it is used to communicate with the HTTP proxy only (not to communicate with the servers).- Parameters:
address
- the HTTP proxy address (host and port)sslContextFactory
- theSslContextFactory.Client
to use to communicate with the HTTP proxyprotocol
- the protocol to use to communicate with the HTTP proxy
-
HttpProxy
Creates a new instance with the given HTTP proxy
Origin
and TLS configuration.The
SslContextFactory
could have a different configuration from the one configured inHttpClient
and it is used to communicate with the HTTP proxy only (not to communicate with the servers).- Parameters:
origin
- the HTTP proxyOrigin
informationsslContextFactory
- theSslContextFactory.Client
to use to communicate with the HTTP proxy
-
-
Method Details
-
newClientConnectionFactory
public ClientConnectionFactory newClientConnectionFactory(ClientConnectionFactory connectionFactory) - Specified by:
newClientConnectionFactory
in classProxyConfiguration.Proxy
- Parameters:
connectionFactory
- the nestedClientConnectionFactory
- Returns:
- a new
ClientConnectionFactory
for this Proxy
-
getURI
- Overrides:
getURI
in classProxyConfiguration.Proxy
- Returns:
- an URI representing this proxy, or null if no URI can represent this proxy
-
requiresTunnel
-