I'm having a heck of a time getting Spring 3.1 / Spring Security 3.1 to allow file uploads.
I have the following controller..
And when I try to access it using a REST client, with Content-Type multipart/form-data set, I get the following exception:
@RequestMapping(value = "/upload", method = RequestMethod.PUT)
public @ResponseBody Account putImage(@RequestParam("title") String title, MultipartHttpServletRequest request, Principal principal)
It seems like this has to do with the Spring Security filter chain, but I'm really not sure what to do about this. Any help or pointers would be very much appreciated - I've spent a lot of my weekend on this seemingly simple problem!
java.lang.IllegalStateException: Current request is not of type [org.springframework.web.multipart.MultipartHttpServletRequest]: SecurityContextHolderAwareRequestWrapper[ FirewalledRequest[ org.apache.catalina.connector.RequestFacade@1aee75b7]]
I've also tried using a @RequestParam MutipartFile in the arguments, but that leads to a different error where it claims that my multipartResolver is not set up (it is).