On Thu, Feb 7, 2013 at 2:44 PM, ddewaele <[email protected]> wrote:
> 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&sslContextParametersRef=sslContextParameters"
> />
>
> ex: https with a proxy
> <to
> uri="https4://endpoint?throwExceptionOnFailure=false&sslContextParametersRef=sslContextParameters&proxyAuthScheme=http4&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&key2=value2&key3=value3 is not the nicest thing to read
> in our camel context.
> Is there a better way of doing it ?
>
Often you can configure global options on the component itself, then
these options is inherited by the endpoints etc.
Though not all Camel components offer this, but check the code /
source of the HttpComponent.
An alternative could be in the uri configuration is to use property
placeholders where you can bulk them
{{mySettings}}
mySettings=key1=value1&key2=value2&....
> 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&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&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.
--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [email protected]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen