MaVVamaldo
MaVVamaldo

Reputation: 2535

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?

Upvotes: 2

Views: 9451

Answers (3)

Domenico Briganti
Domenico Briganti

Reputation: 571

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

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

You can try on URI Template Parser Online

Upvotes: 3

Dave L.
Dave L.

Reputation: 9791

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

http://netlocation:port/application_path?path=%2Fthis%2Fvariable%2Fisapath

Upvotes: 2

Related Questions