Using a URI that contains an underscore with Camel HTTP4

We are trying to use Apache Camel2.16.3 to move some data to a third-party endpoint HTTP. We use HTTP4Component. We set uri, method and query parameters as message headers. However, the endpoint contains an underscore ( _), and we get an exception like this:

Called: java.lang.IllegalArgumentException: Invalid uri: https://x_y.something.com/somePath?q_one=XXXX&q_two=YYYYY . If you redirect / connect http endpoints, then enable the bridgeEndpoint option at the endpoint: Endpoint [https4: // placeholder? ThrowExceptionOnFailure = false]

I am a little versed, and it looks like _this is something that should not be in the URI. This website actually says it is https://x_y.something.com/somePathinvalid but https://xy.something.com/somePathvalid.

Since I cannot change the third-party endpoint, can underscore be avoided somehow? If not, is there another solution or do we need to give up Apache Camelfor this?

+4
source share
2 answers

, , , , HTTP- akka, Camel. , , , - , HTTP4, top override . , :

from("jetty:http://localhost:9090/path")
    .routeId("jetty_server")
    .log("${body}");

from("timer:sender?delay=3000&period=5000")
    .setBody().constant("Ping!")
    .setHeader(Exchange.HTTP_URI, constant("http://localhost:9090/path"))
    .to("http4:x_y.something.com:9090/path?q_one=XXXX&q_two=YYYYY");

, .

+2

, , .

, , . , , , , () , URI. , , bridgeEndpoint.

, Camel. , , - Camel URI-.

, , ; - , , . , . , , , .

0

Source: https://habr.com/ru/post/1651131/


All Articles