You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Vero Kato <ve...@gmail.com> on 2015/12/06 11:32:07 UTC

URL space handling with Camel Rest and Jetty APIs

hi, in our Camel REST/Jetty service we can have spaces, for example:

localhost:8080/rest/ourSerivce/Curren Time/

when we get "/Current Time/" string, it has %20 weird URL characters and we
want to have spaces instead.

we get it like this

rest("/rest/ourSerivce/")
                 .produces("application/json")
                 .get("/{Parameter1}").outType(OurOutput.class)
                 .to("ourSerivce?method=getSomething(${Parameter1}");

how we can nicely get ${Parameter1} converted to normal string with spaces
with Camel Rest/Camel Jetty?

thanks,
Vero

Re: URL space handling with Camel Rest and Jetty APIs

Posted by Joakim Bjørnstad <jo...@gmail.com>.
Hello,

You can't. It's part of the HTTP specification to escape non US-ASCII
characters with % followed by two hex digits representing the octet
code.

You will have to manually replace the %20 with space. As far as I
know, the DSL does not have options to do this for you.

But IMO, change your API design instead.

On Sun, Dec 6, 2015 at 11:32 AM, Vero Kato <ve...@gmail.com> wrote:
> hi, in our Camel REST/Jetty service we can have spaces, for example:
>
> localhost:8080/rest/ourSerivce/Curren Time/
>
> when we get "/Current Time/" string, it has %20 weird URL characters and we
> want to have spaces instead.
>
> we get it like this
>
> rest("/rest/ourSerivce/")
>                  .produces("application/json")
>                  .get("/{Parameter1}").outType(OurOutput.class)
>                  .to("ourSerivce?method=getSomething(${Parameter1}");
>
> how we can nicely get ${Parameter1} converted to normal string with spaces
> with Camel Rest/Camel Jetty?
>
> thanks,
> Vero



-- 
Kind regards
Joakim Bjørnstad