Class Proxy
java.lang.Object
io.helidon.webclient.api.Proxy
A definition of a proxy server to use for outgoing requests.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFluent API builder forProxy.static enumType of the proxy. -
Method Summary
Modifier and TypeMethodDescriptionstatic Proxy.Builderbuilder()Fluent API builder for new instances.static Proxycreate()Create from environment and system properties.static ProxyCreate a new proxy instance from configuration.effectiveRoute(String scheme, String host, int port, boolean tls) Resolve configured proxy policy to one effective route for a logical request target.booleaninthashCode()host()Returns the host.booleanWhether this proxy can select routes using a configured IP-basedno-proxyrule.booleanVerifies whether the current host is inside noHosts.booleanisUsingSystemProxy(String uri) Verifies whether the specified Uri is using system proxy.static ProxynoProxy()A Proxy instance that does not proxy requests.Optional<char[]> password()Returns an Optional with the password.intport()Returns the port.tcpSocket(WebClient webClient, ResolvedClientTarget target, SocketOptions socketOptions) Create a TCP socket for one preselected and resolved route.tcpSocket(WebClient webClient, InetSocketAddress inetSocketAddress, SocketOptions socketOptions, boolean tls) Create a socket for TCP, connected through the proxy.type()Get proxy type.username()Returns an Optional with the username.
-
Method Details
-
builder
-
noProxy
A Proxy instance that does not proxy requests.- Returns:
- a new instance with no proxy definition
-
create
Create a new proxy instance from configuration.proxy: http: uri: https://www.example.org https: uri: https://www.example.org no-proxy: ["*.example.org", "localhost"]- Parameters:
config- configuration, should be located on a key that has proxy as a subkey- Returns:
- proxy instance
-
create
Create from environment and system properties.- Returns:
- a proxy instance configured based on this system settings
-
tcpSocket
public Socket tcpSocket(WebClient webClient, InetSocketAddress inetSocketAddress, SocketOptions socketOptions, boolean tls) Create a socket for TCP, connected through the proxy.- Parameters:
webClient- web client to use if HTTP requests must be doneinetSocketAddress- target address of the request (proxy address is configured as part Proxy instance)socketOptions- options for creating socketstls- whether to use TLS- Returns:
- a new connected socket
-
tcpSocket
public Socket tcpSocket(WebClient webClient, ResolvedClientTarget target, SocketOptions socketOptions) Create a TCP socket for one preselected and resolved route.- Parameters:
webClient- web client used for an HTTP CONNECT exchangetarget- resolved physical targetsocketOptions- socket options- Returns:
- connected socket
-
type
-
isNoHosts
Verifies whether the current host is inside noHosts.- Parameters:
uri- the uri- Returns:
- true if it is in no hosts, otherwise false
-
ipNoProxyConfigured
public boolean ipNoProxyConfigured()Whether this proxy can select routes using a configured IP-basedno-proxyrule.- Returns:
- whether IP-based no-proxy route selection is configured
-
isUsingSystemProxy
Verifies whether the specified Uri is using system proxy.- Parameters:
uri- the uri- Returns:
- true if the uri resource will be proxied
-
effectiveRoute
Resolve configured proxy policy to one effective route for a logical request target. A system selector is invoked exactly once and its selected route is retained by the returned value. Configuredno-proxyrules that contain only host names are evaluated without DNS lookup. IP-based rules are evaluated against the supplied host string by this overload; WebClient's connection-target resolution also evaluates them against the concrete DNS address used for the connection.- Parameters:
scheme- logical request schemehost- logical request hostport- logical request porttls- whether the application connection uses TLS- Returns:
- effective route
-
port
public int port()Returns the port.- Returns:
- proxy port
-
host
-
username
-
password
-
equals
-
hashCode
-