Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9651

Restlet consumer request fails if there is a space '%20' in the url

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.16.2
    • 2.18.0
    • camel-restlet
    • 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.

      Attachments

        1. patch.txt
          1 kB
          Jay mann

        Activity

          People

            davsclaus Claus Ibsen
            jmandawg Jay mann
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: