Jersey PUT方法的Uriinfo

Jersey PUT方法的Uriinfo,jersey,Jersey,我使用Urinfo访问RESTfulWeb服务中的查询参数,如下所示 @GET @Produces("text/plain") @Path("/association") public Response Association( @Context UriInfo uriInfo){ String clinicianId = uriInfo.getQueryParameters().g

我使用Urinfo访问RESTfulWeb服务中的查询参数,如下所示

@GET
    @Produces("text/plain")
    @Path("/association")   
    public Response Association(            
            @Context UriInfo uriInfo){      
            String clinicianId = uriInfo.getQueryParameters().getFirst("clinicianId");
            List<String> providerList = uriInfo.getQueryParameters().get("clinicialProviderId");
@GET
@生成(“文本/纯文本”)
@路径(“/关联”)
公众反应协会(
@上下文UriInfo UriInfo){
字符串clinicianId=uriInfo.getQueryParameters().getFirst(“clinicianId”);
List providerList=uriInfo.getQueryParameters().get(“ClinicalProviderId”);
如何使用uriinfo访问PUTmetod的参数。

同样的方法


也许我不理解这个问题。不管使用何种HTTP方法,查询参数都是以相同的方式访问的。您是说PUT的不同参数吗?您是指表单字段吗?如果您在PUT请求中发送表单数据,并且希望访问表单数据,您可以使用@FormParam将它们注入到方法参数或字段中。顺便说一句,您还可以使用@QueryParam来插入查询参数,而不是使用UriInfo。

是否可以使用UriInfo访问表单参数?否。表单参数是消息实体的一部分,而不是URI的一部分。访问表单参数的另一种方法是将表单类型的参数添加到PUT方法中,然后调用Form.get(“参数名称”)获取参数值。如下所示:
@PUT public Response putsome(Form myForm)
,然后
myForm.get(“foo”)
myForm.getFirst(“foo”)