我正在努力从MSBuild /t:restore
迁移到jersey
服务。
迁移时,我试图在RestEasy
中找到RestEasy
中发布方法中的等效方法。
WebResource
有人可以帮我吗?
答案 0 :(得分:0)
jax-rs 2.0(json)用resteasy做这个的方法是:
创建客户
创建WebTarget
final PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
final CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(cm).build();
cm.setMaxTotal(200);
cm.setDefaultMaxPerRoute(20);
final ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient);
final Client client = new ResteasyClientBuilder().httpEngine(engine).register(ResteasyJackson2Provider.class).build();
对您的终端进行POST调用
final ResteasyWebTarget webtarget = (ResteasyWebTarget) client.target(serviceUrl);