2011-12-13 137 views
0

我有一个关于URI模板变量的问题。包含路径的URI模板变量?

我需要的形式来管理URI:

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

变量可以是一个路径本身,即像

this/variable/is/a/path 

,这样完整的URI显得

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

我该如何管理?

回答

3

使用“+”操作符,以避免逃避“/”字符:

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

您可以尝试在URI Template Parser Online

+0

这是解决我。 – MaVVamaldo

2

您可以使用查询参数,只是编码标准方式的路径变量:

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