我正在使用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();