简体   繁体   中英

Why need extra step by using http.proxyHost for apache camel http component

By using http.proxyHost for apache camel http component. It need two steps below, otherwise http.proxy will not work for camel http component.

  1. put -Dhttp.proxyHost at java command line

  2. at camel http query paramter, setting useSystemProperties to true

but for javax.net.ssl.trustStore, step 2 is not need.

Since both of them(trustStore or httpProxy) are system properties could be used via java command line. Why http.proxyHost need step2, but javax.net.ssl.trustStore does not? Could anyone have some idea?

Thanks in advancace!

Apache Camel HTTP component provide a per URI / Endpoint way of configuring an HTTP proxy:

from("direct:start")
    .to("http://somehost?proxyAuthHost=www.someproxy.com&proxyAuthPort=80");

Adds to that a way to override proxy configuration using a context global options:

context.getGlobalOptions().put("http.proxyHost", "someproxy");
context.getGlobalOptions().put("http.proxyPort", "someport");

This allows the org.apache.http.client.HttpClient to be consider configuration precedence when resolving and creating the HTTP proxy:

  • If the system properties (for the HTTP proxy) are there those will be resolved and loaded
  • If the HTTP proxy global options are there, those will be resolved and used instead of system properties
  • If an endpoint HTTP proxy configuration has been set then this configuration will be resolved and used

All of the configuration resolution steps can be skipped altogether to fallback on using all HTTP(S) related properties (within the underlying org.apache.http.client.HttpClient ) from the system properties if the user wishes so by setting the useSystemProperties component option.

As a summary, you can think of the HTTP related properties resolution process as providing a set of flexible configuration options to the user to fit in all use cases.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM