This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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"
 
Don't get me started about those stupid light bulbs.
 
subject: Problem with @RequestPart with mixed multipart request, Spring MVC 3.2
 
Similar Threads
Unable to create a file using java.io.File
Spring MVC Request Mapping
File Upload using SPRING REST API
file uploading problem ( greater than 2MB)
Unable to upload file