org.apache.axis2.transport.http
Class ProxyConfiguration

java.lang.Object
  extended by org.apache.axis2.transport.http.ProxyConfiguration

public class ProxyConfiguration
extends java.lang.Object

The purpose of this class is to configure the proxy auth regardles of the protocol. Proxy will be set only for HTTP connection


Field Summary
protected static java.lang.String ATTR_PROXY
           
protected static java.lang.String HTTP_NON_PROXY_HOSTS
           
protected static java.lang.String HTTP_PROXY_HOST
           
protected static java.lang.String HTTP_PROXY_PORT
           
protected  java.lang.String nonProxyHosts
           
protected static java.lang.String PROXY_HOST_ELEMENT
           
protected static java.lang.String PROXY_PASSWORD_ELEMENT
           
protected static java.lang.String PROXY_PORT_ELEMENT
           
protected static java.lang.String PROXY_USER_ELEMENT
           
protected  java.lang.String proxyHost
           
protected  java.lang.String proxyPassword
           
protected  int proxyPort
           
protected  java.lang.String proxyUser
           
 
Constructor Summary
ProxyConfiguration()
           
 
Method Summary
 void configure(MessageContext messageContext, org.apache.commons.httpclient.HttpClient httpClient, org.apache.commons.httpclient.HostConfiguration config)
           
 java.lang.String getProxyHost()
          Retrun proxy host
 java.lang.String getProxyPassword()
          set password
 int getProxyPort()
          retrun proxy port
 java.lang.String getProxyUser()
          return proxy user.
static boolean isHostInNonProxyList(java.lang.String host, java.lang.String nonProxyHosts)
          Check if the specified host is in the list of non proxy hosts.
static boolean isProxyEnabled(MessageContext messageContext, java.net.URL targetURL)
          Check first if the proxy is configured or active.
protected static boolean match(java.lang.String pattern, java.lang.String str, boolean isCaseSensitive)
          Matches a string against a pattern.
 void setProxyHost(java.lang.String proxyHost)
          set proxy host
 void setProxyPassword(java.lang.String proxyPassword)
          get password
 void setProxyPort(int proxyPort)
          set proxy port
 void setProxyUser(java.lang.String proxyUser)
          get proxy user
static boolean validateNonProxyHosts(java.lang.String host)
          Validates for names that shouldn't be listered as proxies.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

proxyHost

protected java.lang.String proxyHost

nonProxyHosts

protected java.lang.String nonProxyHosts

proxyPort

protected int proxyPort

proxyUser

protected java.lang.String proxyUser

proxyPassword

protected java.lang.String proxyPassword

HTTP_PROXY_HOST

protected static final java.lang.String HTTP_PROXY_HOST
See Also:
Constant Field Values

HTTP_PROXY_PORT

protected static final java.lang.String HTTP_PROXY_PORT
See Also:
Constant Field Values

HTTP_NON_PROXY_HOSTS

protected static final java.lang.String HTTP_NON_PROXY_HOSTS
See Also:
Constant Field Values

ATTR_PROXY

protected static final java.lang.String ATTR_PROXY
See Also:
Constant Field Values

PROXY_HOST_ELEMENT

protected static final java.lang.String PROXY_HOST_ELEMENT
See Also:
Constant Field Values

PROXY_PORT_ELEMENT

protected static final java.lang.String PROXY_PORT_ELEMENT
See Also:
Constant Field Values

PROXY_USER_ELEMENT

protected static final java.lang.String PROXY_USER_ELEMENT
See Also:
Constant Field Values

PROXY_PASSWORD_ELEMENT

protected static final java.lang.String PROXY_PASSWORD_ELEMENT
See Also:
Constant Field Values
Constructor Detail

ProxyConfiguration

public ProxyConfiguration()
Method Detail

configure

public void configure(MessageContext messageContext,
                      org.apache.commons.httpclient.HttpClient httpClient,
                      org.apache.commons.httpclient.HostConfiguration config)
               throws AxisFault
Throws:
AxisFault

isProxyEnabled

public static boolean isProxyEnabled(MessageContext messageContext,
                                     java.net.URL targetURL)
                              throws AxisFault
Check first if the proxy is configured or active. If yes this will return true. This is not a deep check

Parameters:
messageContext -
Returns:
boolean
Throws:
AxisFault

validateNonProxyHosts

public static boolean validateNonProxyHosts(java.lang.String host)
Validates for names that shouldn't be listered as proxies. The http.nonProxyHosts can be set to specify the hosts which should be connected to directly (not through the proxy server). The value of the http.nonProxyHosts property can be a list of hosts, each separated by a |; it can also take a regular expression for matches; for example: *.sfbay.sun.com would match any fully qualified hostname in the sfbay domain. For more information refer to : http://java.sun.com/features/2002/11/hilevel_network.html false : validation fail : User can use the proxy true : validation pass ; User can't use the proxy

Returns:
boolean

isHostInNonProxyList

public static boolean isHostInNonProxyList(java.lang.String host,
                                           java.lang.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

match

protected static boolean match(java.lang.String pattern,
                               java.lang.String str,
                               boolean isCaseSensitive)
Matches a string against a pattern. The pattern contains two special characters: '*' which means zero or more characters,

Parameters:
pattern - the (non-null) pattern to match against
str - the (non-null) string that must be matched against the pattern
isCaseSensitive -
Returns:
true when the string matches against the pattern, false otherwise.

getProxyHost

public java.lang.String getProxyHost()
Retrun proxy host

Returns:
String

setProxyHost

public void setProxyHost(java.lang.String proxyHost)
set proxy host

Parameters:
proxyHost -

getProxyPort

public int getProxyPort()
retrun proxy port

Returns:
String

setProxyPort

public void setProxyPort(int proxyPort)
set proxy port

Parameters:
proxyPort -

getProxyUser

public java.lang.String getProxyUser()
return proxy user. Proxy user can be user/domain or user

Returns:
String

setProxyUser

public void setProxyUser(java.lang.String proxyUser)
get proxy user

Parameters:
proxyUser -

getProxyPassword

public java.lang.String getProxyPassword()
set password

Returns:
String

setProxyPassword

public void setProxyPassword(java.lang.String proxyPassword)
get password

Parameters:
proxyPassword -


Copyright © 2007 Apache Web Services Project. All Rights Reserved.