public class HttpProxyConfiguration extends Object
This class itself is independent of HttpClient. See
HttpClientProxyConfiguration
for how to apply
this configuration to an HttpClient instance.
fromSystemProperties()
,
fromProperties(Properties)
Modifier and Type | Class and Description |
---|---|
static class |
HttpProxyConfiguration.ProxyAuthentication |
Modifier and Type | Field and Description |
---|---|
static String |
NON_PROXY_HOSTS_PROPERTY |
static String |
NTLM_DOMAIN_PROPERTY |
static String |
PROXY_AUTHENTICATION |
static String |
PROXY_HOST_PROPERTY |
static String |
PROXY_PASSWORD_PROPERTY |
static String |
PROXY_PORT_PROPERTY |
static String |
PROXY_USERNAME_PROPERTY |
Modifier and Type | Method and Description |
---|---|
static HttpProxyConfiguration |
fromProperties(Properties properties)
Creates a new ProxyConfiguration using the standard properties, using the Properties object provided.
|
static HttpProxyConfiguration |
fromSystemProperties()
Creates a new ProxyConfiguration using the standard properties, reading from
System.getProperties() . |
List<HttpProxyConfiguration.ProxyAuthentication> |
getAuthentication()
Returns the types of authentication to use in preference order.
|
String |
getHost()
Returns the proxy host name, or null if no proxy is defined.
|
String |
getNtlmDomain()
Returns the NTLM authentication domain of the proxy server.
|
String |
getPassword()
Returns the proxy password, or null if the password is not set.
|
int |
getPort()
Returns the proxy port.
|
String |
getUsername()
Returns the proxy username, or null if the username is not set.
|
boolean |
hasBasicAuthentication()
Returns true if the configuration includes basic authentication details, i.e.
|
boolean |
hasDigestAuthentication()
Returns true if the configuration includes digest authentication details, i.e.
|
boolean |
hasNtlmAuthentication()
Returns true if the configuration includes NTLM authentication details, i.e.
|
boolean |
isProxyConfigured()
Returns true if a proxy server is configured (i.e.
|
boolean |
shouldProxy(String destinationHost)
Returns true if the proxy is configured and the host is not in the list of "non-proxy hosts".
|
public static final String PROXY_HOST_PROPERTY
public static final String PROXY_PORT_PROPERTY
public static final String PROXY_USERNAME_PROPERTY
public static final String PROXY_PASSWORD_PROPERTY
public static final String NTLM_DOMAIN_PROPERTY
public static final String NON_PROXY_HOSTS_PROPERTY
public static final String PROXY_AUTHENTICATION
public static HttpProxyConfiguration fromSystemProperties()
System.getProperties()
.
The non-proxy hosts property is a pipe-delimited lists of hosts or domains with a wildcard at the start. For example: "server.example.org|*.example.com".
The proxy authentication property defines the preference order of authentication methods. By default, the order is HttpClient's default order: NTLM, Digest, Basic. You may need to change this if your server advertises that it supports NTLM and Basic authentication, but you only have a Basic authentication credentials. The format of this property is a comma-separated list of values from the HttpClient AuthPolicy class. For example: "basic,ntlm" will try Basic authentication then NTLM authentication.
public static HttpProxyConfiguration fromProperties(Properties properties)
See fromSystemProperties()
for a discussion of the properties.
properties
- the properties to use for reading the proxy informationpublic boolean isProxyConfigured()
public boolean shouldProxy(String destinationHost)
isProxyConfigured()
public boolean hasBasicAuthentication()
public boolean hasDigestAuthentication()
public boolean hasNtlmAuthentication()
public List<HttpProxyConfiguration.ProxyAuthentication> getAuthentication()
public String getHost()
public int getPort()
public String getUsername()
public String getPassword()
public String getNtlmDomain()
Copyright © 2003–2016 Atlassian. All rights reserved.