[
https://issues.apache.org/jira/browse/CAMEL-9396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15044442#comment-15044442
]
Claus Ibsen commented on CAMEL-9396:
------------------------------------
This uri is the uri of the http server to call. Its not the same as the Camel
endpoint uri, where you can configure endpoint options such as security etc.
This header does not support that, its only the uri of the http server.
> http4 and Exchange.HTTP_URI
> ---------------------------
>
> Key: CAMEL-9396
> URL: https://issues.apache.org/jira/browse/CAMEL-9396
> Project: Camel
> Issue Type: Bug
> Components: camel-http4
> Affects Versions: 2.16.1
> Environment: jdk7, mac
> Reporter: Minh Tran
> Assignee: Claus Ibsen
>
> It seems that when using Exchange.HTTP_URI, the options added in here doesn't
> get stripped off the actual request and is being interpretted as part of the
> url rather than as an endpoint option.
> This is a working example
> {noformat}
> from("direct:start").
> setHeader(Exchange.HTTP_METHOD, constant("POST")).
> to("http4:localhost:8080/path?authenticationPreemptive=true&authUsername=myUser&authPassword=myPass");
> {noformat}
> The output from apache httpclient logging is showing the Authorization header
> being correctly set
> {noformat}
> 2015-12-07 11:29:51,139 [main] DEBUG org.apache.http.headers -
> http-outgoing-0 >> POST /path HTTP/1.1
> 2015-12-07 11:29:51,140 [main] DEBUG org.apache.http.headers -
> http-outgoing-0 >> Authorization: Basic bXlVc2VyOm15UGFzcw==
> {noformat}
> Now we do the same but use Exchange.HTTP_URI
> {noformat}
> from("direct:start").
> setHeader(Exchange.HTTP_METHOD, constant("POST")).
> setHeader(Exchange.HTTP_URI,
> constant("http4://localhost:8080/newPath?authenticationPreemptive=true&authUsername=myUser&authPassword=myPass")).
> // deliberately changed settings here to verify we are not hitting it
> to("https4:host:80/path");
> {noformat}
> This is the output of apache httpclient logs
> {noformat}
> 2015-12-07 11:32:19,595 [main] DEBUG org.apache.http.headers -
> http-outgoing-0 >> POST
> /newPath?authenticationPreemptive=true&authUsername=myUser&authPassword=myPass
> HTTP/1.1
> {noformat}
> Notice the missing Authorization header and the path includes the uri options
> as well
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)