We are currently using the Camel http4 component to perform both http and
https calls either directly or through a proxy. All these scenarios work by
configuring the http4 component in a certain way

ex: plain http without proxy
<to uri="http4://endpoint?throwExceptionOnFailure=false" />

ex: https without proxy
<to
uri="https4://endpoint?throwExceptionOnFailure=false&amp;sslContextParametersRef=sslContextParameters"
/>

ex: https with a proxy
<to
uri="https4://endpoint?throwExceptionOnFailure=false&amp;sslContextParametersRef=sslContextParameters&amp;proxyAuthScheme=http4&amp;proxyAuthHost=proxy-host......"
/>

I had 2 questions regarding that: 

1. Is there a way to externalize the proxy settings in a proxyParametersRef
component, and just reference it, similar to the sslContextParameters bean ?

We have a lot of http4 components in our flow, and we find that we
constantly have to repeat the following proxy properties in the endpoint :

proxyAuthScheme
proxyAuthHost
proxyAuthPort
proxyAuthUsername
proxyAuthDomain
proxyAuthPassword
proxyAuthNtHost

This results in a lot of duplication, and the
?key=value&amp;key2=value2&amp;key3=value3 is not the nicest thing to read
in our camel context. 
Is there a better way of doing it ?

2. Certain backends are targeted either using http or https (depending on
the environment). 

How can we dynamically choose to either use the http endpoint or the https
endpoint ?

<to uri="http4://endpoint?throwExceptionOnFailure=false" />
<to
uri="https4://endpoint?throwExceptionOnFailure=false&amp;sslContextParametersRef=sslContextParameters"
/>

There has to be something better than putting this in our flows :

<choice>
        <when>
                
                <simple>${header.CamelHttpUri.substring(0,5)} == 
"https"</simple>
                <to
uri="https4://endpoint?throwExceptionOnFailure=false&amp;sslContextParametersRef=sslContextParameters"
/>
        </when>
        <otherwise>
                <to uri="http4://endpoint?throwExceptionOnFailure=false" />
        </otherwise>
<choice>

To simplify our flows, it would be nice to have an http endpoint that
detects if it needs http or https (depending on the CamelHttpUri).

Is such a thing possible in Camel ?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Configuring-the-Camel-http4-component-tp5727123.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to