Package com.teamdev.jxbrowser.net.proxy
Class CustomProxyConfig
java.lang.Object
com.teamdev.jxbrowser.net.proxy.CustomProxyConfig
- All Implemented Interfaces:
ProxyConfig
A custom proxy settings.
-
Method Summary
Modifier and TypeMethodDescriptionReturns a string that represents the proxy exceptions or an empty string if there are no exceptions.static CustomProxyConfig
newInstance
(String proxyRules) Creates a custom proxy configuration based on the givenproxyRules
.static CustomProxyConfig
newInstance
(String proxyRules, String proxyExceptions) Creates a custom proxy configuration based on the givenproxyRules
andproxyExceptions
.Returns a string that represents the proxy rules.
-
Method Details
-
newInstance
Creates a custom proxy configuration based on the givenproxyRules
.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
- whenproxyRules
is empty or blank
-
newInstance
Creates a custom proxy configuration based on the givenproxyRules
andproxyExceptions
.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 formatproxyExceptions
- a string that represents the proxy exceptions in the described format- Throws:
IllegalArgumentException
- whenproxyRules
is empty or blank
-
exceptions
Returns a string that represents the proxy exceptions or an empty string if there are no exceptions. -
proxyRules
Returns a string that represents the proxy rules.
-