RESTEasy-获取整个查询字符串

RESTEasy-获取整个查询字符串,rest,web-services,get,resteasy,Rest,Web Services,Get,Resteasy,我想在get方法中获取整个查询字符串。例如,如果uri是 主机:端口/应用程序?参数1=123和参数2=xyz和参数3=4 我想得到“param1=123¶m2=xyz¶m3=4”部分。可能吗 谢谢。你可以去,在那里你可以找到一切。例如,在您的资源中: public class MyResource { @Context private HttpServletRequest request; @GET public void get() { this.re

我想在get方法中获取整个查询字符串。例如,如果uri是

主机:端口/应用程序?参数1=123和参数2=xyz和参数3=4

我想得到“param1=123¶m2=xyz¶m3=4”部分。可能吗

谢谢。

你可以去,在那里你可以找到一切。例如,在您的资源中:

public class MyResource {
  @Context
  private HttpServletRequest request;
  @GET
  public void get() {
    this.request.getQueryString();
  }
}
真的很老了。。。但是:

您应该映射@Context并按如下方式获取查询部分: .getRequestUri().getQuery()

    @POST
    @Path("/{path}")
    public Response transform(@PathParam String path, @Context UriInfo uriInfo, String inputData) {
...
        String query = uriInfo.getRequestUri().getQuery();
        System.out.println(query); // null if no query parameter is supplied
...