Cannot implement simple file upload in Jersey

Cannot implement simple file upload in Jersey

Unable to implement simple file upload using Jersey. Missing dependency
errors raised at application bootstrap:
The following errors and warnings have been detected with resource and/or
provider classes:
SEVERE: Missing dependency for method public javax.ws.rs.core.Response
com.foo.MyResource.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition)
at parameter at index 0
SEVERE: Missing dependency for method public javax.ws.rs.core.Response
com.foo.MyResource.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition)
at parameter at index 1
SEVERE: Method, public javax.ws.rs.core.Response
com.foo.uploadFile(java.io.InputStream,com.sun.jersey.core.header.FormDataContentDisposition),
annotated with POST of resource, class com.foo.FS2Resource, is not
recognized as valid resource method.
unavailable
com.sun.jersey.spi.inject.Errors$ErrorMessagesException
at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)
It seems like there is an issue with mapping the input parameters to a
REST service? I have read documentation and followed several examples, and
I am not deviating from those examples.
Here's the code:
@Path("v1/")
public class FileUploadResource {
@POST
@Path("upload")
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({MediaType.APPLICATION_JSON})
public Response uploadFile(
@FormDataParam("file") InputStream is,
@FormDataParam("file") FormDataContentDisposition detail) {
String name = detail.getFileName();
// do upload stuff
String output = ....
return Response.status(200).entity(output).build();
}
}
I pulled in "compile 'com.sun.jersey.contribs:jersey-multipart:1.17.1'"
for the FormDataParams.