I get this error:
SEVERE: Resource methods utilizing @FormParam and consuming "multipart/form-data" are no longer supported. See @FormDataParam
When a client web access is done for a Apache Jersey based Rest web service I am working right now:
@POST
@Path("upload")
@Consumes("multipart/form-data")
@Produces("text/plain")
public String uploadFile(@FormParam("file") File file, @FormParam("file") FormDataContentDisposition fileDetail) {
String fileLocation = "/files/" + fileDetail.getFileName();
System.out.println("File location: " + fileLocation);
// Load image
try {
byte[] imageBytes = loadImage(fileLocation);
MongoConnection conn = MongoUtil.getConnection();
conn.connect("m1", "avatar");
GridFS fs = new GridFS(conn.getDB());
GridFSInputFile in = fs.createFile(imageBytes);
in.save();
} catch (Exception e) {
e.printStackTrace();
}
return "1";
}
I have tried changing from @FormParam
to @FormDataParam
but it's unresolved.
What could be the fix for this?