REST how to pass values containing “/” as path par

2020-08-01 05:59发布

I am developing a Client using HttpClient in Java to access a REST Application. In this i want to pass two parameters name(value="Kiran") and address(Value="5th Corner/Road") as path parameters .

Sample url:-http://localhost:port/rest/name/Kiran/address/5th Corner/Road

But as address contains "/" as value, its not taking the actual value. Is there a way to handle "/" while accessing REST applications from Java.

Any help is appreciated.

标签: java rest get
1条回答
淡お忘
2楼-- · 2020-08-01 06:45

Use java.net.URLEncoder to encode the query parameters.

查看更多
登录 后发表回答