我想將一個列表作爲參數,但列表的值不對應於java版本列表。例如@QueryParam(「orderBy」)List orderBy) 該列表的值爲[age,name]作爲元素。Jersey,@QueryParam List <String>
是否有可能分開的值。像第一元素年齡和第二元素名稱一樣。
`
@GET
@Path("/range")
@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
public Response searchForActivitiesWithRange(@QueryParam(value = "description")List<String> descriptions,
@QueryParam(value = "durationFrom") int durationFrom,
@QueryParam(value = "durationTo") int durationTo) {
List<Activity> activities = activityRepository.findByDescriptionandDuration(descriptions,durationFrom,durationTo);
if (activities == null || activities.size() == 0) {
return Response.status(Status.NOT_FOUND).build();
}
return Response.ok().entity(new GenericEntity<List<Activity>>(activities){}).build();
}`