2016-09-07 104 views
0

我有这样的代码:org.glassfish.jersey.client.ClientResponse不能应用于给定类型

Version version = commonClient.authorizedRequestBuilder(commonClient.webTarget 
      .path("/apps/blabla/default/" + appName + "/" + appName) 
      .queryParam("object_type", "app")) 
      .accept(MediaType.APPLICATION_JSON_TYPE) 
      .get(ClientResponse.class) 
      .getEntity(new GenericType<Version>() {}); 

我怎么能解决这个问题,解决这个问题?

Error:(38, 17) java: method getEntity in class org.glassfish.jersey.client.ClientResponse cannot be applied to given types; 
    required: no arguments 
    found: <anonymous javax.ws.rs.core.GenericType<linqmap.supportool.services.gas.dto.Version>> 
    reason: actual and formal argument lists differ in length 

回答

0

的getEntity()方法不接受任何参数,所以你不能传递(新GenericType(){})

使用以下代替

Version version = commonClient.authorizedRequestBuilder(commonClient.webTarget 
     .path("/apps/blabla/default/" + appName + "/" + appName) 
     .queryParam("object_type", "app")) 
     .accept(MediaType.APPLICATION_JSON_TYPE) 
     .get(ClientResponse.class) 
     .getEntity(); 
相关问题