You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kalber <Ka...@swslt.com> on 2015/12/29 16:31:34 UTC

http, authentication by 'GET' method

Hi, 

i want to pass this piece of code to  http4 component :
------------------------------------------------------------------------------------------------------------------------------------
HttpGet get = new HttpGet(URL + "?" + URLEncodedUtils.format(queryParams,
"UTF-8"));

UsernamePasswordCredentials credentials =
new UsernamePasswordCredentials(USERNAME, PASSWORD);
get.addHeader(BasicScheme.authenticate(credentials, "UTF-8", false));

HttpResponse response = httpClient.execute(get);
--------------------------------------------------------------------------------------------------------------------------------------

My problem is the authentication, what have i done :

 .setHeader(Exchange.HTTP_METHOD, constant("GET"))
 .to("
https://x.y.it:443/transit-service/timetables/ids?authPassword=password&authUsername=username&&from=20151226&&to=20151228")

But i get  this error :

org.apache.camel.http.common.HttpOperationFailedException: HTTP operation
failed invoking
https://x.y.it/transit-service/timetables/ids?from=20151226&to=20151228 with
statusCode: 401

How can i pass authentication correctly in this GET ?




-----
kh
--
View this message in context: http://camel.465427.n5.nabble.com/http-authentication-by-GET-method-tp5775574.html
Sent from the Camel - Users mailing list archive at Nabble.com.