javahttpresturiuritemplate

URI Template variable containing a path?


I have a question about URI template variables.

I need to manage an URI with the form:

http://netlocation:port/application_path/{variable}

the variable can be a path itself, i.e. something like

this/variable/is/a/path

so that the complete URI appears to be

http://netlocation:port/application_path/this/variable/is/a/path

how can I manage that?


Solution

  • Use the "+" operator in order to avoid escaping the "/" character:

    http://netlocation:port/application_path/{+foo}
    

    You can try on URI Template Parser Online