• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with @RequestPart with mixed multipart request, Spring MVC 3.2

 
Raghvendra Pratap Singh
Greenhorn
Posts: 22
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm developing a RESTful service based on Spring 3.2. I'm facing a problem with a controller handling mixed multipart HTTP request, with a Second part with XMLor JSON formatted data and a second part with a Image file .

I am using @RequestPart for rthe request






User.java will be like this-





To my understanding, using the @RequestPart annotation I would expect the XML multipart section to be evaluated depending on its Content-Type and finally un-marshalled into my User class (I'm using Jaxb2, the marshaller/unmarhaller is properly configured in the application context and the procedure is working fine for all the other controller methods when I pass the XML data as body and use the @RequestBody annotation).

But what is actually happening is that, although the file is correctly found and parsed as MultipartFile, the "user" part is never seen and the request is always failing, not matching the controller method signature.



I reproduced the problem with several clients type and I am confident the format of the multipart request is ok.

Please help me to solve this issue,May be some workaround will be there to receive mixed/multipart request.



Thanks and Regards,
Raghvendra

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic