@GET
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Path("/categories")
public Response getAllCategories(@QueryParam(value = "code") String country_code) {
return userService.getAllCategories(country_code);
}我的url:"/user/categories?code=+91"
如何在RESTful web服务中提取请求参数"+91“。
发布于 2016-08-18 10:38:11
@QueryParam是JAX.如果您想使用Spring,适当的注释将是@RequestParam
public Response getAllCategories(@RequestParam("code") String country_code) {
...
}当然,@Path等也不是Spring,所以也许您应该问问自己是否真的想使用Spring.
https://stackoverflow.com/questions/39015727
复制相似问题