轻量级的jax-rs客户端

时间:2013-11-22 09:16:42

标签: rest java-ee jax-rs

使用以下代码示例教程我可以成功发布到glassfish-4上的jax-rs服务。

Client client = ClientFactory.newClient();
WebTarget root = client.target("http://localhost:8080/roast-house/api/coffeebeans");
Bean origin = new Bean("arabica", RoastType.DARK, "mexico");
final String mediaType = MediaType.APPLICATION_XML;
final Entity<Bean> entity = Entity.entity(origin, mediaType);
Response response = root.request().post(entity, Response.class);
response.close();

但它强制带来总共约4.5mb的依赖(resteasy 3.0.5约为5mb)

<dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-client</artifactId>
    <version>2.4.1</version>
</dependency> 

我感觉我只使用了一部分客户端API,那里是否有更轻量级的客户端,或者我将如何仅使用标准库来构建请求?

0 个答案:

没有答案