Class CustomProxyConfig

java.lang.Object
com.teamdev.jxbrowser.net.proxy.CustomProxyConfig
All Implemented Interfaces:
ProxyConfig

public final class CustomProxyConfig extends Object implements ProxyConfig
A custom proxy settings.
  • Method Details

    • newInstance

      public static CustomProxyConfig newInstance(String proxyRules)
      Creates a custom proxy configuration based on the given proxyRules.

      The examples of the proxy rules:

      • "http=foopy:80;ftp=foopy2" - use HTTP proxy "foopy:80" for http:// URLs, and HTTP proxy "foopy2:80" for ftp:// URLs.
      • "foopy:80" - use HTTP proxy "foopy:80" for all URLs.
      • "socks4://foopy" - use SOCKS v4 proxy "foopy:1080" for all URLs.
      Parameters:
      proxyRules - a string that represents the proxy rules in the described format
      Throws:
      IllegalArgumentException - when proxyRules is empty or blank
    • newInstance

      public static CustomProxyConfig newInstance(String proxyRules, String proxyExceptions)
      Creates a custom proxy configuration based on the given proxyRules and proxyExceptions.

      The examples of the proxy rules:

      • "http=foopy:80;ftp=foopy2" - use HTTP proxy "foopy:80" for http:// URLs, and HTTP proxy "foopy2:80" for ftp:// URLs.
      • "foopy:80" - use HTTP proxy "foopy:80" for all URLs.
      • "socks4://foopy" - use SOCKS v4 proxy "foopy:1080" for all URLs.

      The format of the exceptions can be any of the following:

      • [ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]. Examples: "foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99", "https://x.*.y.com:99"
      • "." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]. Examples: ".google.com", ".com", "http://.google.com"
      • [ SCHEME "://" ] IP_LITERAL [ ":" PORT ]. Examples: "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
      • IP_LITERAL "/" PREFIX_LENGHT_IN_BITS. Examples: "192.168.1.1/16", "fefe:13::abc/33"
      • "<local>". Match local addresses. The meaning of "<local>" is whether the host matches one of: "127.0.0.1", "::1", "localhost".

      If you need to provide several exception rules you can separate them using comma: "*foobar.com,.google.com,<local>".

      Parameters:
      proxyRules - a string that represents the proxy rules in the described format
      proxyExceptions - a string that represents the proxy exceptions in the described format
      Throws:
      IllegalArgumentException - when proxyRules is empty or blank
    • exceptions

      public String exceptions()
      Returns a string that represents the proxy exceptions or an empty string if there are no exceptions.
    • proxyRules

      public String proxyRules()
      Returns a string that represents the proxy rules.