Using a naked servlet's doPost, when a file upload starts, doPost is immediately called. I can then stream the files from the request object using the commons FileItemIterator.
Using Spring MVC, I can't seem to get the controller method to fire until after the file(s) have all been received by the server, which is not ideal.
I want my servlet/controller method to process as many files as it can and perform some rollback operations if an upload is interrupted. I can't do that with Spring MVC currently.
public void doPost(HttpServletRequest request, HttpServletResponse res){
//I can immediately stream the response here
}
vs.
@RequestMapping(value="/uploadFiles", method= RequestMethod.POST)
public @ResponseBody String addFiles(ContentManagerTicket ticket, HttpServletRequest request){
//I can't do anything until the files are received - whether i use a HttpServletRequset or MultiPartFile
}
Any ideas? Thanks!