ProxyConfig
public final class ProxyConfig
Config for setProxyOverride.
Proxy rules should be added using addProxyRule methods. Multiple rules can be used as fallback if a proxy fails to respond (for example, the proxy server is down). Bypass rules can be set for URLs that should not use these settings.
For instance, the following code means that WebView would first try to use proxy1.com for all URLs, if that fails, proxy2.com, and if that fails, it would make a direct connection.
ProxyConfig proxyConfig = new ProxyConfig.Builder().addProxyRule("proxy1.com")
.addProxyRule("proxy2.com")
.addDirect()
.build();Summary
Nested types |
|---|
public final class ProxyConfig.BuilderProxyConfig builder. |
public final class ProxyConfig.ProxyRuleClass that holds a scheme filter and a proxy URL. |
Constants |
|
|---|---|
static final String |
MATCH_ALL_SCHEMES = "*"Matches all schemes. |
static final String |
MATCH_HTTP = "http"HTTP scheme. |
static final String |
MATCH_HTTPS = "https"HTTPS scheme. |
Public methods |
|
|---|---|
@NonNull List<String> |
Returns the current list that holds the bypass rules represented by this object. |
@NonNull List<ProxyConfig.ProxyRule> |
Returns the current list of proxy rules. |
boolean |
Returns |
Constants
MATCH_ALL_SCHEMES
public static final String MATCH_ALL_SCHEMES = "*"
Matches all schemes.
Public methods
getBypassRules
public @NonNull List<String> getBypassRules()
Returns the current list that holds the bypass rules represented by this object.
To add new rules use addBypassRule.
getProxyRules
public @NonNull List<ProxyConfig.ProxyRule> getProxyRules()
Returns the current list of proxy rules. Each ProxyRule object holds the proxy URL and the URL schemes for which this proxy is used (one of MATCH_HTTP, MATCH_HTTPS, MATCH_ALL_SCHEMES).
To add new rules use addProxyRule or addProxyRule.
| Returns | |
|---|---|
@NonNull List<ProxyConfig.ProxyRule> |
List of proxy rules |
isReverseBypassEnabled
public boolean isReverseBypassEnabled()
Returns true if reverse bypass is enabled. Reverse bypass means that only URLs in the bypass list will use these proxy settings. getBypassRules returns the URL list.
See setReverseBypassEnabled for a more detailed description.
| Returns | |
|---|---|
boolean |
reverseBypass |