com.ning.http.util
Class ProxyUtils

java.lang.Object
  extended by com.ning.http.util.ProxyUtils

public class ProxyUtils
extends Object

Utilities for Proxy handling.

Author:
cstamas

Field Summary
static String PROXY_HOST
          The host to use as proxy.
static String PROXY_NONPROXYHOSTS
          A specification of non-proxy hosts.
static String PROXY_PASSWORD
          The password to use for authentication for the proxy server.
static String PROXY_PORT
          The port to use for the proxy.
static String PROXY_PROTOCOL
          The protocol to use.
static String PROXY_USER
          The username to use for authentication for the proxy server.
 
Constructor Summary
ProxyUtils()
           
 
Method Summary
static boolean avoidProxy(ProxyServer proxyServer, Request request)
          Checks whether proxy should be used according to nonProxyHosts settings of it, or we want to go directly to target host.
static boolean avoidProxy(ProxyServer proxyServer, String target)
          Checks whether proxy should be used according to nonProxyHosts settings of it, or we want to go directly to target host.
static ProxyServer createProxy(Properties properties)
          Creates a proxy server instance from the given properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROXY_HOST

public static final String PROXY_HOST
The host to use as proxy.

See Also:
Constant Field Values

PROXY_PORT

public static final String PROXY_PORT
The port to use for the proxy.

See Also:
Constant Field Values

PROXY_PROTOCOL

public static final String PROXY_PROTOCOL
The protocol to use. Is mapped to the ProxyServer.Protocol enum.

See Also:
Constant Field Values

PROXY_NONPROXYHOSTS

public static final String PROXY_NONPROXYHOSTS
A specification of non-proxy hosts. See http://download.oracle.com/javase/1.4.2/docs/guide/net/properties.html

See Also:
Constant Field Values

PROXY_USER

public static final String PROXY_USER
The username to use for authentication for the proxy server.

See Also:
Constant Field Values

PROXY_PASSWORD

public static final String PROXY_PASSWORD
The password to use for authentication for the proxy server.

See Also:
Constant Field Values
Constructor Detail

ProxyUtils

public ProxyUtils()
Method Detail

avoidProxy

public static boolean avoidProxy(ProxyServer proxyServer,
                                 Request request)
Checks whether proxy should be used according to nonProxyHosts settings of it, or we want to go directly to target host. If null proxy is passed in, this method returns true -- since there is NO proxy, we should avoid to use it. Simple hostname pattern matching using "*" are supported, but only as prefixes. See http://download.oracle.com/javase/1.4.2/docs/guide/net/properties.html

Parameters:
proxyServer -
request -
Returns:
true if we have to avoid proxy use (obeying non-proxy hosts settings), false otherwise.

avoidProxy

public static boolean avoidProxy(ProxyServer proxyServer,
                                 String target)
Checks whether proxy should be used according to nonProxyHosts settings of it, or we want to go directly to target host. If null proxy is passed in, this method returns true -- since there is NO proxy, we should avoid to use it. Simple hostname pattern matching using "*" are supported, but only as prefixes. See http://download.oracle.com/javase/1.4.2/docs/guide/net/properties.html

Parameters:
proxyServer -
target - the hostname
Returns:
true if we have to avoid proxy use (obeying non-proxy hosts settings), false otherwise.

createProxy

public static ProxyServer createProxy(Properties properties)
Creates a proxy server instance from the given properties.

Currently the default http.* proxy properties are supported as well as properties specific for AHC.

Parameters:
properties - the properties to evaluate. Must not be null.
Returns:
a ProxyServer instance or null, if no valid properties were set.
See Also:
http://download.oracle.com/javase/1.4.2/docs/guide/net/properties.html, PROXY_HOST, PROXY_PORT, PROXY_PROTOCOL, PROXY_NONPROXYHOSTS


Copyright © 2011. All Rights Reserved.