org.apache.axis2.transport.http.util
Class HTTPProxyConfigurationUtil

java.lang.Object
  extended by org.apache.axis2.transport.http.util.HTTPProxyConfigurationUtil

public class HTTPProxyConfigurationUtil
extends Object

Contains utility functions used when configuring HTTP Proxy for HTTP Sender.


Field Summary
protected static String ATTR_PROXY
           
protected static String HTTP_NON_PROXY_HOSTS
           
protected static String HTTP_PROXY_HOST
           
protected static String HTTP_PROXY_PORT
           
protected static String PROXY_CONFIGURATION_NOT_FOUND
           
protected static String PROXY_HOST_ELEMENT
           
protected static String PROXY_HOST_ELEMENT_NOT_FOUND
           
protected static String PROXY_HOST_ELEMENT_WITH_EMPTY_VALUE
           
protected static String PROXY_PASSWORD_ELEMENT
           
protected static String PROXY_PORT_ELEMENT
           
protected static String PROXY_PORT_ELEMENT_NOT_FOUND
           
protected static String PROXY_PORT_ELEMENT_WITH_EMPTY_VALUE
           
protected static String PROXY_USER_ELEMENT
           
 
Constructor Summary
HTTPProxyConfigurationUtil()
           
 
Method Summary
static void configure(MessageContext messageContext, org.apache.commons.httpclient.HttpClient httpClient, org.apache.commons.httpclient.HostConfiguration config)
          Configure HTTP Proxy settings of commons-httpclient HostConfiguration.
static boolean isHostInNonProxyList(String host, String nonProxyHosts)
          Check if the specified host is in the list of non proxy hosts.
static boolean isProxyEnabled(MessageContext messageContext, URL targetURL)
          Check whether http proxy is configured or active.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTP_PROXY_HOST

protected static final String HTTP_PROXY_HOST
See Also:
Constant Field Values

HTTP_PROXY_PORT

protected static final String HTTP_PROXY_PORT
See Also:
Constant Field Values

HTTP_NON_PROXY_HOSTS

protected static final String HTTP_NON_PROXY_HOSTS
See Also:
Constant Field Values

ATTR_PROXY

protected static final String ATTR_PROXY
See Also:
Constant Field Values

PROXY_HOST_ELEMENT

protected static final String PROXY_HOST_ELEMENT
See Also:
Constant Field Values

PROXY_PORT_ELEMENT

protected static final String PROXY_PORT_ELEMENT
See Also:
Constant Field Values

PROXY_USER_ELEMENT

protected static final String PROXY_USER_ELEMENT
See Also:
Constant Field Values

PROXY_PASSWORD_ELEMENT

protected static final String PROXY_PASSWORD_ELEMENT
See Also:
Constant Field Values

PROXY_CONFIGURATION_NOT_FOUND

protected static final String PROXY_CONFIGURATION_NOT_FOUND
See Also:
Constant Field Values

PROXY_HOST_ELEMENT_NOT_FOUND

protected static final String PROXY_HOST_ELEMENT_NOT_FOUND
See Also:
Constant Field Values

PROXY_PORT_ELEMENT_NOT_FOUND

protected static final String PROXY_PORT_ELEMENT_NOT_FOUND
See Also:
Constant Field Values

PROXY_HOST_ELEMENT_WITH_EMPTY_VALUE

protected static final String PROXY_HOST_ELEMENT_WITH_EMPTY_VALUE
See Also:
Constant Field Values

PROXY_PORT_ELEMENT_WITH_EMPTY_VALUE

protected static final String PROXY_PORT_ELEMENT_WITH_EMPTY_VALUE
See Also:
Constant Field Values
Constructor Detail

HTTPProxyConfigurationUtil

public HTTPProxyConfigurationUtil()
Method Detail

configure

public static void configure(MessageContext messageContext,
                             org.apache.commons.httpclient.HttpClient httpClient,
                             org.apache.commons.httpclient.HostConfiguration config)
                      throws AxisFault
Configure HTTP Proxy settings of commons-httpclient HostConfiguration. Proxy settings can be get from axis2.xml, Java proxy settings or can be override through property in message context.

HTTP Proxy setting element format: example.org 3128 EXAMPLE/John password

Parameters:
messageContext - in message context for
httpClient - commons-httpclient instance
config - commons-httpclient HostConfiguration
Throws:
AxisFault - if Proxy settings are invalid

isProxyEnabled

public static boolean isProxyEnabled(MessageContext messageContext,
                                     URL targetURL)
Check whether http proxy is configured or active. This is not a deep check.

Parameters:
messageContext - in message context
targetURL - URL of the edpoint which we are sending the request
Returns:
true if proxy is enabled, false otherwise

isHostInNonProxyList

public static boolean isHostInNonProxyList(String host,
                                           String nonProxyHosts)
Check if the specified host is in the list of non proxy hosts.

Parameters:
host - host name
nonProxyHosts - string containing the list of non proxy hosts
Returns:
true/false


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.