Class CamelProxyRoutePlanner

java.lang.Object
org.apache.hc.client5.http.impl.routing.DefaultRoutePlanner
org.apache.hc.client5.http.impl.routing.DefaultProxyRoutePlanner
org.apache.camel.component.http.CamelProxyRoutePlanner
All Implemented Interfaces:
org.apache.hc.client5.http.routing.HttpRoutePlanner

public class CamelProxyRoutePlanner extends org.apache.hc.client5.http.impl.routing.DefaultProxyRoutePlanner
A custom HTTP route planner that extends DefaultProxyRoutePlanner to support selective proxy bypassing based on hostname patterns. This route planner allows certain hosts to bypass the configured proxy server by matching hostnames against a set of patterns. This is similar to the behavior of the Java system property http.nonProxyHosts.
See Also:
  • DefaultProxyRoutePlanner
  • HttpRoutePlanner
  • Constructor Summary

    Constructors
    Constructor
    Description
    CamelProxyRoutePlanner(org.apache.hc.core5.http.HttpHost proxy, Set<String> noProxyHosts)
    Constructs a new CamelProxyRoutePlanner with the specified proxy and non-proxy hosts.
    CamelProxyRoutePlanner(org.apache.hc.core5.http.HttpHost proxy, org.apache.hc.client5.http.SchemePortResolver schemePortResolver, Set<String> noProxyHosts)
    Constructs a new CamelProxyRoutePlanner with the specified proxy, scheme port resolver, and non-proxy hosts.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.apache.hc.core5.http.HttpHost
    determineProxy(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.protocol.HttpContext context)
    Determines the proxy to use for the given target host.

    Methods inherited from class org.apache.hc.client5.http.impl.routing.DefaultRoutePlanner

    determineLocalAddress, determineRoute, determineRoute

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CamelProxyRoutePlanner

      public CamelProxyRoutePlanner(org.apache.hc.core5.http.HttpHost proxy, Set<String> noProxyHosts)
      Constructs a new CamelProxyRoutePlanner with the specified proxy and non-proxy hosts.
      Parameters:
      proxy - the proxy host to use for requests that don't match non-proxy patterns. Must not be null.
      noProxyHosts - a set of hostname patterns that should bypass the proxy. Can be null or empty to disable proxy bypassing. Patterns may contain wildcards (*).
    • CamelProxyRoutePlanner

      public CamelProxyRoutePlanner(org.apache.hc.core5.http.HttpHost proxy, org.apache.hc.client5.http.SchemePortResolver schemePortResolver, Set<String> noProxyHosts)
      Constructs a new CamelProxyRoutePlanner with the specified proxy, scheme port resolver, and non-proxy hosts.
      Parameters:
      proxy - the proxy host to use for requests that don't match non-proxy patterns. Must not be null.
      schemePortResolver - the scheme port resolver to use for determining default ports. Can be null to use default resolver.
      noProxyHosts - a set of hostname patterns that should bypass the proxy. Can be null or empty to disable proxy bypassing. Patterns may contain wildcards (*).
  • Method Details

    • determineProxy

      protected org.apache.hc.core5.http.HttpHost determineProxy(org.apache.hc.core5.http.HttpHost target, org.apache.hc.core5.http.protocol.HttpContext context) throws org.apache.hc.core5.http.HttpException
      Determines the proxy to use for the given target host. This method checks if the target hostname matches any of the configured non-proxy host patterns. If a match is found, the method returns null to bypass the proxy. Otherwise, it delegates to the parent class to use the configured proxy.
      Overrides:
      determineProxy in class org.apache.hc.client5.http.impl.routing.DefaultProxyRoutePlanner
      Parameters:
      target - the target host for the request. Must not be null.
      context - the HTTP context for the request. Can be null.
      Returns:
      the proxy to use for this target, or null to connect directly without a proxy
      Throws:
      org.apache.hc.core5.http.HttpException - if an error occurs during proxy determination