在使用jersey库的多部分响应中得到下面的错误,知道这个错误是什么吗?消息错误:
MessageBodyWriter not found for media type=multipart/mixed, type=class org.glassfish.jersey.message.internal.OutboundJaxrsResponse$Builder, genericType=class javax.ws.rs.core.Response$ResponseBuilder.
代码如下:
@Produces("multipart/mixed")
InputStream input = new FileInputStream("C://Users//1234//test.jpg");
MultiPart multiPart = new MultiPart();
BodyPart bodyPart = new BodyPart(input, MediaType.APPLICATION_OCTET_STREAM_TYPE);
multiPart.bodyPart(bodyPart);
return Response.status(Response.Status.OK).entity(multiPart);
web.xml文件:
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.wu.IWATCHRetrieve</param-value>
</init-param>
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>org.glassfish.jersey.media.multipart.MultiPartFeature</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
暂无答案!
目前还没有任何答案,快来回答吧!