File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Problem with @RequestPart with mixed multipart request, Spring MVC 3.2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Problem with @RequestPart with mixed multipart request, Spring MVC 3.2" Watch "Problem with @RequestPart with mixed multipart request, Spring MVC 3.2" New topic
Author

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

Raghvendra Pratap Singh
Greenhorn

Joined: Jul 26, 2012
Posts: 22

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


Thanks and Regards, Raghvendra Pratap Singh
"Quality means doing it right when no one is looking"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with @RequestPart with mixed multipart request, Spring MVC 3.2