我想限制一组查询参数用于休息方法。
@Path("/users")
public class UserService {
@GET
@Path("/query")
public Response getUsers(
@QueryParam("from") int from,
@QueryParam("to") int to,
@QueryParam("orderBy") List<String> orderBy) {
return Response
.status(200)
.entity("getUsers is called, from : " + from + ", to : " + to
+ ", orderBy" + orderBy.toString()).build();
}
}
“users / query?from = 100&amp; to = 200&amp; orderBy = age&amp; orderBy = name”[WORKS] “users / query?x = y”[也适用,当我的查询参数设置为默认值时]
我想基于此抛出一些例外。