Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.16.2
-
None
-
Novice
Description
Consuming a restful service using restlet component fails with URISyntaxException if there is a special character or space in the URL.
To fix this org.apache.camel.component.restlet.RestletComponent should:
@Override public boolean useRawUri() { // should use encoded uri by default return true; }
Simple example of failure:
rest("/Utils") .description("Camel Utilities Rest Service") .consumes("application/json").produces("application/json") .get("test/testme").route().log("Got HEre"). to("restlet:http://localhost:8299/Utils/test2/TEST%20Name?throwExceptionOnFailure=false&restletMethod=GET") .getRestDefinition() .get("test2/{name2}").route().log("GOt ${header.name2}");
If you remove the space it works fine.
Caused by: java.net.URISyntaxException: Illegal character in path at index 38: http://localhost:8299/Utils/test2/TEST Name
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parseHierarchical(URI.java:3105)
at java.net.URI$Parser.parse(URI.java:3053)
at java.net.URI.<init>(URI.java:588)
at org.apache.camel.component.restlet.RestletComponent.createEndpoint(RestletComponent.java:120)
at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:114)
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:570)
It seems like there are lots of bugs with restlet component, What is the most mature service for consuming restful/http services?
Thanks.