我正在尝试获取与我的研究标准相对应的所有产品的列表值,在我的案例中,研究标准是使用 Postman(GET METHOD)的参考和区域:
https://localhost/services/choices/?ref=test1&ref=test2®ion=west
但是每当我尝试在我的代码中获取我的引用时,我都会收到一个大小为零的列表。
@Path("/choices")
@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "get products")
@ApiResponses(value = {@ApiResponse(code=200,message = "Success"),
@ApiResponse(code=500, message = "Server error")
})
public Response getProduct(@QueryParam("ref") final List<String> ref,
@QueryParam("region") final String region,
@Context final HttpServletRequest request){
LOGGER.info("Call for references {} and region {}",ref,region);
try{
return Response.ok(productBusinessService.getProducts(ref,region)).build();
}catch (Exception e){
throw new InternalServerErrorHttpException("Technical Error", e.getMessage(), e);
}finally {
LOGGER.info("End of the Call for references {} and region {}",ref,region);
}
}
我的问题是:是否可以在邮递员中传递具有相同键名的多个查询参数,如果是,为什么我在获取区域值时收到空列表