You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Martin Stiborský <ma...@gmail.com> on 2013/08/21 13:47:03 UTC

http4 component and preemptive authentication

Hello guys,
I just switched http component for all my routes to http4 component, we did
some performance testing and it really looks better. (Btw, anyone
interested in the results? Measured with JMeter, simple route, just
fetching xml file...).

The switch is kind of a hack, I did it via EventNotifierSupport
and CamelContextStartedEvent.
When camel context is started, I remove "http" component from registry and
put under that key "http4" component.
Why I did so is because now I don't have to change my configuration files,
where I have many http endpoints specified, used in DSL, resolved from
config with "simple" properties markup. So I'd have to rewrite the config
values with "http4" prefix.
Btw, how much bad idea is this solution? I'm not sure if I like it but it
works...

About my main problem now, preemtive auth is not supported in http4
component, right?
See (Camel 2.11.0) :

org.apache.camel.ResolveEndpointFailedException: Failed to resolve
endpoint:
http://10.32.232.61:8080/api/json?authMethod=Basic&authPassword=bar&authUsername=foo&httpClient.authenticationPreemptive=truedue
to: There are 1 parameters that couldn't be set on the endpoint. Check
the uri if the parameters are spelt correctly and that they are properties
of the endpoint. Unknown parameters=[{authenticationPreemptive=true}]

I see that it's possible with HttpClient 4.x:
http://stackoverflow.com/questions/2014700/preemptive-basic-authentication-with-apache-httpclient-4

I need preemtive auth for integration with Jenkins through its "JSON/RPC"
API...
https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients

For now I'll try to solve it, following this thread:
http://camel.465427.n5.nabble.com/Camel-HTTP4-not-able-to-use-httpContext-endpoint-option-td5735937.html

But I don't like to know your opinion and how it should work in http4
component.

Thanks guys!

-- 
S pozdravem / Best regards
Martin Stiborský

Jabber: stibi@njs.netlab.cz
Twitter: http://www.twitter.com/stibi

Re: http4 component and preemptive authentication

Posted by Claus Ibsen <cl...@gmail.com>.
Hi Martin

Great to hear. Looking forward to your contribution(s). Hope to see
more in the future.
Fell free to log a JIRA ticket etc.

On Tue, Sep 3, 2013 at 9:26 PM, Martin Stiborský
<ma...@gmail.com> wrote:
> Ok I'm finally digging there, so far no mystery, fun! :)
>
>
> On Fri, Aug 23, 2013 at 11:08 AM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> Hi
>>
>> Yeah would be nice if it was easier with camel-http4. Maybe we can add
>> authenticationPreemptive as a new option explicit on the http
>> endpoint, and then have logic that setup the authentication.
>>
>> Seems like a few line of codes from this SO with the 50+ votes (in the
>> comment section)
>>
>> http://stackoverflow.com/questions/2014700/preemptive-basic-authentication-with-apache-httpclient-4
>>
>> Fell free to dive into this. As you know we love contributions. And
>> patches and JIRA tickets is welcome
>>
>> On Wed, Aug 21, 2013 at 1:47 PM, Martin Stiborský
>> <ma...@gmail.com> wrote:
>> > Hello guys,
>> > I just switched http component for all my routes to http4 component, we
>> did
>> > some performance testing and it really looks better. (Btw, anyone
>> > interested in the results? Measured with JMeter, simple route, just
>> > fetching xml file...).
>> >
>> > The switch is kind of a hack, I did it via EventNotifierSupport
>> > and CamelContextStartedEvent.
>> > When camel context is started, I remove "http" component from registry
>> and
>> > put under that key "http4" component.
>> > Why I did so is because now I don't have to change my configuration
>> files,
>> > where I have many http endpoints specified, used in DSL, resolved from
>> > config with "simple" properties markup. So I'd have to rewrite the config
>> > values with "http4" prefix.
>> > Btw, how much bad idea is this solution? I'm not sure if I like it but it
>> > works...
>> >
>> > About my main problem now, preemtive auth is not supported in http4
>> > component, right?
>> > See (Camel 2.11.0) :
>> >
>> > org.apache.camel.ResolveEndpointFailedException: Failed to resolve
>> > endpoint:
>> >
>> http://10.32.232.61:8080/api/json?authMethod=Basic&authPassword=bar&authUsername=foo&httpClient.authenticationPreemptive=truedue
>> > to: There are 1 parameters that couldn't be set on the endpoint. Check
>> > the uri if the parameters are spelt correctly and that they are
>> properties
>> > of the endpoint. Unknown parameters=[{authenticationPreemptive=true}]
>> >
>> > I see that it's possible with HttpClient 4.x:
>> >
>> http://stackoverflow.com/questions/2014700/preemptive-basic-authentication-with-apache-httpclient-4
>> >
>> > I need preemtive auth for integration with Jenkins through its "JSON/RPC"
>> > API...
>> >
>> https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients
>> >
>> > For now I'll try to solve it, following this thread:
>> >
>> http://camel.465427.n5.nabble.com/Camel-HTTP4-not-able-to-use-httpContext-endpoint-option-td5735937.html
>> >
>> > But I don't like to know your opinion and how it should work in http4
>> > component.
>> >
>> > Thanks guys!
>> >
>> > --
>> > S pozdravem / Best regards
>> > Martin Stiborský
>> >
>> > Jabber: stibi@njs.netlab.cz
>> > Twitter: http://www.twitter.com/stibi
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> Email: cibsen@redhat.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>
>
>
> --
> S pozdravem / Best regards
> Martin Stiborský
>
> Jabber: stibi@njs.netlab.cz
> Twitter: http://www.twitter.com/stibi



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: http4 component and preemptive authentication

Posted by Martin Stiborský <ma...@gmail.com>.
Ok I'm finally digging there, so far no mystery, fun! :)


On Fri, Aug 23, 2013 at 11:08 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> Yeah would be nice if it was easier with camel-http4. Maybe we can add
> authenticationPreemptive as a new option explicit on the http
> endpoint, and then have logic that setup the authentication.
>
> Seems like a few line of codes from this SO with the 50+ votes (in the
> comment section)
>
> http://stackoverflow.com/questions/2014700/preemptive-basic-authentication-with-apache-httpclient-4
>
> Fell free to dive into this. As you know we love contributions. And
> patches and JIRA tickets is welcome
>
> On Wed, Aug 21, 2013 at 1:47 PM, Martin Stiborský
> <ma...@gmail.com> wrote:
> > Hello guys,
> > I just switched http component for all my routes to http4 component, we
> did
> > some performance testing and it really looks better. (Btw, anyone
> > interested in the results? Measured with JMeter, simple route, just
> > fetching xml file...).
> >
> > The switch is kind of a hack, I did it via EventNotifierSupport
> > and CamelContextStartedEvent.
> > When camel context is started, I remove "http" component from registry
> and
> > put under that key "http4" component.
> > Why I did so is because now I don't have to change my configuration
> files,
> > where I have many http endpoints specified, used in DSL, resolved from
> > config with "simple" properties markup. So I'd have to rewrite the config
> > values with "http4" prefix.
> > Btw, how much bad idea is this solution? I'm not sure if I like it but it
> > works...
> >
> > About my main problem now, preemtive auth is not supported in http4
> > component, right?
> > See (Camel 2.11.0) :
> >
> > org.apache.camel.ResolveEndpointFailedException: Failed to resolve
> > endpoint:
> >
> http://10.32.232.61:8080/api/json?authMethod=Basic&authPassword=bar&authUsername=foo&httpClient.authenticationPreemptive=truedue
> > to: There are 1 parameters that couldn't be set on the endpoint. Check
> > the uri if the parameters are spelt correctly and that they are
> properties
> > of the endpoint. Unknown parameters=[{authenticationPreemptive=true}]
> >
> > I see that it's possible with HttpClient 4.x:
> >
> http://stackoverflow.com/questions/2014700/preemptive-basic-authentication-with-apache-httpclient-4
> >
> > I need preemtive auth for integration with Jenkins through its "JSON/RPC"
> > API...
> >
> https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients
> >
> > For now I'll try to solve it, following this thread:
> >
> http://camel.465427.n5.nabble.com/Camel-HTTP4-not-able-to-use-httpContext-endpoint-option-td5735937.html
> >
> > But I don't like to know your opinion and how it should work in http4
> > component.
> >
> > Thanks guys!
> >
> > --
> > S pozdravem / Best regards
> > Martin Stiborský
> >
> > Jabber: stibi@njs.netlab.cz
> > Twitter: http://www.twitter.com/stibi
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cibsen@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>



-- 
S pozdravem / Best regards
Martin Stiborský

Jabber: stibi@njs.netlab.cz
Twitter: http://www.twitter.com/stibi

Re: http4 component and preemptive authentication

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah would be nice if it was easier with camel-http4. Maybe we can add
authenticationPreemptive as a new option explicit on the http
endpoint, and then have logic that setup the authentication.

Seems like a few line of codes from this SO with the 50+ votes (in the
comment section)
http://stackoverflow.com/questions/2014700/preemptive-basic-authentication-with-apache-httpclient-4

Fell free to dive into this. As you know we love contributions. And
patches and JIRA tickets is welcome

On Wed, Aug 21, 2013 at 1:47 PM, Martin Stiborský
<ma...@gmail.com> wrote:
> Hello guys,
> I just switched http component for all my routes to http4 component, we did
> some performance testing and it really looks better. (Btw, anyone
> interested in the results? Measured with JMeter, simple route, just
> fetching xml file...).
>
> The switch is kind of a hack, I did it via EventNotifierSupport
> and CamelContextStartedEvent.
> When camel context is started, I remove "http" component from registry and
> put under that key "http4" component.
> Why I did so is because now I don't have to change my configuration files,
> where I have many http endpoints specified, used in DSL, resolved from
> config with "simple" properties markup. So I'd have to rewrite the config
> values with "http4" prefix.
> Btw, how much bad idea is this solution? I'm not sure if I like it but it
> works...
>
> About my main problem now, preemtive auth is not supported in http4
> component, right?
> See (Camel 2.11.0) :
>
> org.apache.camel.ResolveEndpointFailedException: Failed to resolve
> endpoint:
> http://10.32.232.61:8080/api/json?authMethod=Basic&authPassword=bar&authUsername=foo&httpClient.authenticationPreemptive=truedue
> to: There are 1 parameters that couldn't be set on the endpoint. Check
> the uri if the parameters are spelt correctly and that they are properties
> of the endpoint. Unknown parameters=[{authenticationPreemptive=true}]
>
> I see that it's possible with HttpClient 4.x:
> http://stackoverflow.com/questions/2014700/preemptive-basic-authentication-with-apache-httpclient-4
>
> I need preemtive auth for integration with Jenkins through its "JSON/RPC"
> API...
> https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients
>
> For now I'll try to solve it, following this thread:
> http://camel.465427.n5.nabble.com/Camel-HTTP4-not-able-to-use-httpContext-endpoint-option-td5735937.html
>
> But I don't like to know your opinion and how it should work in http4
> component.
>
> Thanks guys!
>
> --
> S pozdravem / Best regards
> Martin Stiborský
>
> Jabber: stibi@njs.netlab.cz
> Twitter: http://www.twitter.com/stibi



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen