REST 的多个参数 API

Multiple parameters for REST API

这是为 REST API 设置多个参数的正确方法吗?

@GET
@Path("/id/{userId,type,date}")
@Nullable
@Produces(MediaType.APPLICATION_JSON)
List<Exercise> findExercises(
        @ApiParam( value = "User ID", required=true) @PathParam("userId") Long userId,
        @ApiParam( value = "Type") @PathParam("type") String type,
        @ApiParam( value = "Date") @PathParam("date") String date);

如果没有,我该如何实现?

您应该按如下方式分隔路径参数: @Path("/id/{userId}/{type}/{date}")

我想这是正确的方法:

@GET
@Path("/id/{userId}/{type}/{date}")
@Nullable
@Produces(MediaType.APPLICATION_JSON)
List<Exercise> findExercises(
        @PathParam("userId") Long userId,
        @PathParam("type") String type,
        @PathParam("date") String date);