首页 > 代码库 > Jesery客户端工具类

Jesery客户端工具类

public class JerseyClientUtil {    public static<T> T sendMsg(String url,Object object,Class<T> clazz){        ClientConfig config=new DefaultClientConfig(JacksonJsonProvider.class);        config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING,Boolean.TRUE);        Client client=Client.create(config);        WebResource resource=client.resource(url);        ClientResponse response=resource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON).post(ClientResponse.class,object);        return response.getEntity(clazz);    }}

 

Jesery客户端工具类