[英]How to define @path annotation for two variables in jar-s
I want to get two parameter inputs from the user for my rest service. 我想从用户那里获得两个参数输入以用于我的休息服务。
eg: restservice/name/id
例如: restservice/name/id
User will call; 用户将致电;
restservice/philip/1000
To handle above url request, in my rest service, how should i define @path annotation? 为了处理上述url请求,在我的REST服务中,我应该如何定义@path注释?
@POST
@Path("/{name}/") -->?
public void processname() {
}
@POST
@Path("/{id}/") ------>?
public void procesId() {
}
@POST
@Path("/users/{userId}")
public Response addDevice(@PathParam("userId") Long userId) {
// your code
return Response.ok("Success").build();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.