Package org.apache.synapse.transport.http.conn

## Class ProxyConfig

- java.lang.Object
- - org.apache.synapse.transport.http.conn.ProxyConfig

-     public class ProxyConfig
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ProxyConfig​(org.apache.http.HttpHost proxy, org.apache.http.auth.UsernamePasswordCredentials creds, String[] proxyBypass, Map<String,​ProxyProfileConfig> proxyProfileMap)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ProxyAuthenticator` | `createProxyAuthenticator()` | returns DefaultProxyAuthenticator if single proxy server is configured ProfileProxyAuthenticator if proxy profile is configured
    `org.apache.http.auth.UsernamePasswordCredentials` | `getCredentialsForTargetHost​(String targetHost)` | select the proxy credential for the targetHost
    `org.apache.http.auth.UsernamePasswordCredentials` | `getCreds()` |
    `org.apache.http.HttpHost` | `getProxy()` |
    `Set<String>` | `getProxyBypass()` |
    `boolean` | `isProxyProfileConfigured()` | checks weather the proxy profile map is empty
    `String` | `logProxyConfig()` | returns appropriate log message based on the proxy configuration whether loading proxy profile or single proxy server or no proxy configured
    `org.apache.http.HttpHost` | `selectProxy​(org.apache.http.HttpHost target)` | Selects the configured proxy server
    `String` | `toString()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ProxyConfig

          public ProxyConfig​(org.apache.http.HttpHost proxy,
                             org.apache.http.auth.UsernamePasswordCredentials creds,
                             String[] proxyBypass,
                             Map<String,​ProxyProfileConfig> proxyProfileMap)

  - ### Method Detail

    - #### getProxy

          public org.apache.http.HttpHost getProxy()

    - #### getCreds

          public org.apache.http.auth.UsernamePasswordCredentials getCreds()

    - #### getProxyBypass

          public Set<String> getProxyBypass()

    - #### selectProxy

          public org.apache.http.HttpHost selectProxy​(org.apache.http.HttpHost target)

      Selects the configured proxy server
      Parameters:
        `target` - request endpoint
      Returns:
        proxy host based on the proxy profile or http.proxyHost, null when no proxy is configured or if the target is matched with proxy bypass

    - #### isProxyProfileConfigured

          public boolean isProxyProfileConfigured()

      checks weather the proxy profile map is empty
      Returns:
        true if proxy profile map is not empty, false otherwise

    - #### getCredentialsForTargetHost

          public org.apache.http.auth.UsernamePasswordCredentials getCredentialsForTargetHost​(String targetHost)

      select the proxy credential for the targetHost
      Parameters:
        `targetHost` - targeted host
      Returns:
        proxy credential for the given end point, if not returns null

    - #### logProxyConfig

          public String logProxyConfig()

      returns appropriate log message based on the proxy configuration whether loading proxy profile or single proxy server or no proxy configured
      Returns:
        log message

    - #### createProxyAuthenticator

          public ProxyAuthenticator createProxyAuthenticator()
                                                      throws org.apache.axis2.AxisFault

      returns DefaultProxyAuthenticator if single proxy server is configured ProfileProxyAuthenticator if proxy profile is configured
      Returns:
        ProxyAuthenticator, if proxy is not configured null
      Throws:
        `org.apache.axis2.AxisFault`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`