如何在JaxRS中的QueryParams中放置通配符注释?

时间:2018-03-27 12:27:11

标签: java jax-rs

jaxrs中的我的控制器看起来像这样

@GET
    @Path("/search/{index}/{type}")
    @Produces(MediaType.APPLICATION_JSON)
    public MapBiodivResponse list(
            @PathParam("index") String index, @PathParam("type") String type,
            @QueryParam("trait_8") String trait_8, @QueryParam("trait_9") String trait_9,
            @QueryParam("trait_10") String trait_10, @QueryParam("trait_11") String trait_11,
            @QueryParam("trait_12") String trait_12, @QueryParam("trait_13") String trait_13,
            @QueryParam("trait_15") String trait_15,
            @QueryParam("bottom") Double bottom,
            ){

            }

我想知道是否有可能在jaxrs中收集所有的queryParams,它们将子字符串作为特征并将其放入Map中。像这样的东西

@GET
    @Path("/search/{index}/{type}")
    @Produces(MediaType.APPLICATION_JSON)
    public MapBiodivResponse list(
            @PathParam("index") String index, @PathParam("type") String type,
            @QueryParam("trait.*") String trait_8, @QueryParam("trait.*") Map trait,
            @QueryParam("bottom") Double bottom,
            ){

            }

我知道使用@Context获取所有参数的方法,但我只是想根据正则表达式或一些通配符收集一些queryParams。

0 个答案:

没有答案