Maven jersey-multipart 缺少 javax.ws.rs.core.Response 的依赖项
我似乎缺少依赖项,但找不到解决方案...我已确保所有球衣版本与此处的回答相同.
I seem to have a missing dependency but can't find the solution... I've made sure all jersey versions are identical as answered here.
错误:
SEVERE: The following errors and warnings have been detected with resource and/or provider classes:
SEVERE: Missing dependency for method public abstract javax.ws.rs.core.Response com.service.copy(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition) at parameter at index 0
使用的依赖项:
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.17</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>1.17</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.17</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.17</version>
</dependency>
<dependency>
<groupId>org.jvnet</groupId>
<artifactId>mimepull</artifactId>
<version>1.6</version>
</dependency>
发生错误的代码:
@POST
@Path("copy")
public Response copy(@FormDataParam("file") InputStream uploadedInputStream,
@FormDataParam("file") FormDataContentDisposition fileDetail);
有什么想法吗?非常感谢提前,弗兰克
Any ideas? Thanks a lot in advance, Frank
推荐答案
是的,找到了!
显然依赖是好的.
将这些添加到我的导入中
Added these to my imports
import javax.ws.rs.Consumes;
import javax.ws.rs.core.MediaType;
并将代码改为
@POST
@Path("copy")
@Consumes(MediaType.MULTIPART_FORM_DATA)
public Response copy(@FormDataParam("file") InputStream uploadedInputStream,
@FormDataParam("file") FormDataContentDisposition fileDetail);
现在突然一切正常!所以希望我可以帮助其他有同样问题的人......
And now suddenly everything works! So hope I can help someone else with the same problem...
相关文章