Class Proxy

java.lang.Object
io.helidon.webclient.api.Proxy

public class Proxy extends Object
A definition of a proxy server to use for outgoing requests.
  • Method Details

    • builder

      public static Proxy.Builder builder()
      Fluent API builder for new instances.
      Returns:
      a new builder
    • noProxy

      public static Proxy noProxy()
      A Proxy instance that does not proxy requests.
      Returns:
      a new instance with no proxy definition
    • create

      public static Proxy create(Config config)
      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

      public static Proxy 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 done
      inetSocketAddress - target address of the request (proxy address is configured as part Proxy instance)
      socketOptions - options for creating sockets
      tls - whether to use TLS
      Returns:
      a new connected socket
    • type

      public Proxy.ProxyType type()
      Get proxy type.
      Returns:
      the proxy type
    • isNoHosts

      public boolean isNoHosts(InetSocketAddress uri)
      Verifies whether the current host is inside noHosts.
      Parameters:
      uri - the uri
      Returns:
      true if it is in no hosts, otherwise false
    • isUsingSystemProxy

      public boolean isUsingSystemProxy(String uri)
      Verifies whether the specified Uri is using system proxy.
      Parameters:
      uri - the uri
      Returns:
      true if the uri resource will be proxied
    • port

      public int port()
      Returns the port.
      Returns:
      proxy port
    • host

      public String host()
      Returns the host.
      Returns:
      proxy host
    • username

      public Optional<String> username()
      Returns an Optional with the username.
      Returns:
      the username
    • password

      public Optional<char[]> password()
      Returns an Optional with the password.
      Returns:
      the password
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object