【发布时间】:2014-05-13 13:03:18
【问题描述】:
我正在使用 RESTEasy 客户端。
Maven 依赖:
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-client</artifactId>
<version>3.0.1.Final</version>
</dependency>
而且我不知道如何使用 multipart 调用 webresource?
在服务器端是这样定义的方法:
@PUT
@Consumes(MimeHelp.MULTIPART_FORM_DATA)
@Produces(MimeHelp.JSON_UTF8)
@Path("/path")
public Response multipart(@Multipart(value = "firstPart", type = "text/plain") InputStream firstStream,
@Multipart(value = "secondPart", type = "text/plain") InputStream secondStream) {
现在请帮我处理客户端代码
WebTarget target = client.target("http://localhost:8080").path("path");
//TODO somehow fill multipart
Response response = target.request().put(/*RESTEasy multipart entity or something*/);
response.close();
【问题讨论】:
-
This answer 到 RestEasy client framework file upload 可能会有所帮助。
标签: java rest client jax-rs resteasy