Reputation: 83
I'm using Jersey to upload a file. This is the rest:
@Path("/MyUpload")
@POST
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.TEXT_PLAIN)
public String MyUpload(@Context HttpServletRequest request,
@FormDataParam("file") InputStream uploadedInputStream,
@FormDataParam("file") FormDataContentDisposition fileInfo) {
// here I’m handling the input stream
…
return “Ok”;
}
When I send a file with size more than 10KB I get 400 bad request for this method.
Any ideas?
I'm running my app on tomcat7 with linux red hat 6.2.
Thanks..
Upvotes: 1
Views: 1696
Reputation: 440
My solution is: change the buggy Jersey libs from version 1.13 (or lower) to the latest version. 1.17 and 1.19 worked for me.
Upvotes: 0
Reputation: 68715
One problem is that you are fetching both the request multipart
params using the same name file
. You need to distinguish the two parts using different names for multipart
params.
Upvotes: 1