1

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?

MaVVamaldo
  • 2,505
  • 7
  • 28
  • 50

3 Answers3

3

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

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

You can try on URI Template Parser Online

Nico
  • 1,554
  • 1
  • 23
  • 35
2

You could use query parameters and just encode the path variable in the standard way:

http://netlocation:port/application_path?path=%2Fthis%2Fvariable%2Fisapath
Dave L.
  • 9,595
  • 7
  • 43
  • 69