使用GET方法使用名称从API检索数据

时间:2015-12-17 23:18:36

标签: java rest jersey jackson jetty

我正在构建一个REST API,并想知道如何使用他的名字来检索用户数据。我目前有URI example.com/rest/users/{name},但是如果有人在他的名字中包含斜杠,那么这将不起作用。那我该怎么做? (使用泽西岛)

2 个答案:

答案 0 :(得分:2)

你可以这样做:

 example.com/rest/users?name={encoded name} 

答案 1 :(得分:-1)

你能检查一下吗?

slashes in url variables

提到

You need to escape the slashes as %2F