Class ProxyConfigBean

java.lang.Object
org.openqa.selenium.htmlunit.options.ProxyConfigBean
All Implemented Interfaces:
Serializable

public class ProxyConfigBean extends Object implements Serializable
A JavaBean representation of a proxy configuration. This class provides getters and setters for common proxy properties such as host, port, scheme, SOCKS flag, bypass hosts, and auto-configuration URL. It also provides utilities to convert to and from ProxyConfig.

Example usage:

 ProxyConfigBean bean = new ProxyConfigBean();
 bean.setHost("proxy.example.com");
 bean.setPort(8080);
 bean.setScheme("http");
 bean.setSocksProxy(false);
 bean.setBypassHosts(Arrays.asList("localhost", "127.0.0.1"));
 ProxyConfig proxyConfig = bean.build();
 
Author:
Scott Babcock, Ronald Brill
See Also:
  • Constructor Details

    • ProxyConfigBean

      public ProxyConfigBean()
  • Method Details

    • getHost

      public String getHost()
      Returns the proxy host.
      Returns:
      the proxy host
    • setHost

      public void setHost(String host)
      Sets the proxy host.
      Parameters:
      host - the proxy host to set
    • getPort

      public int getPort()
      Returns the proxy port.
      Returns:
      the proxy port
    • setPort

      public void setPort(int port)
      Sets the proxy port.
      Parameters:
      port - the proxy port to set
    • getScheme

      public String getScheme()
      Returns the proxy scheme.
      Returns:
      the proxy scheme
    • setScheme

      public void setScheme(String scheme)
      Sets the proxy scheme.
      Parameters:
      scheme - the proxy scheme to set
    • isSocksProxy

      public boolean isSocksProxy()
      Indicates if this is a SOCKS proxy.
      Returns:
      true if SOCKS proxy, false otherwise
    • setSocksProxy

      public void setSocksProxy(boolean socksProxy)
      Sets whether this is a SOCKS proxy.
      Parameters:
      socksProxy - true to use SOCKS proxy, false otherwise
    • getBypassHosts

      public List<String> getBypassHosts()
      Returns the list of bypass hosts.
      Returns:
      the list of bypass hosts
    • getBypassHosts

      public String getBypassHosts(int index)
      Returns a bypass host at the specified index.
      Parameters:
      index - the index of the bypass host
      Returns:
      the bypass host at the specified index
    • setBypassHosts

      public void setBypassHosts(List<String> bypassHosts)
      Sets the list of bypass hosts.
      Parameters:
      bypassHosts - the list of bypass hosts to set
    • setBypassHosts

      public void setBypassHosts(int index, String bypassHost)
      Sets a specific bypass host at the given index.
      Parameters:
      index - the index to set
      bypassHost - the bypass host to set
    • getAutoConfigUrl

      public String getAutoConfigUrl()
      Returns the auto-configuration URL.
      Returns:
      the auto-config URL
    • setAutoConfigUrl

      public void setAutoConfigUrl(String autoConfigUrl)
      Sets the auto-configuration URL.
      Parameters:
      autoConfigUrl - the URL to set
    • encodeProxyConfig

      public static Map<String,Object> encodeProxyConfig(ProxyConfig value)
      Encodes a ProxyConfig object into a Map representation.
      Parameters:
      value - the ProxyConfig to encode
      Returns:
      a map representing the proxy configuration
    • build

      public ProxyConfig build()
      Builds a ProxyConfig object from this bean.
      Returns:
      a ProxyConfig with the properties of this bean