• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multipart/form-data cancel issue

 
Milan Tomc
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm uploading files to a database.

When the user chooses the file and presses "upload-button" (submit) the data starts streaming. Then I wanted to see what would happen if I click something else whilst busy (like another link, button or browsers stop button) and that has cost me a day and a half now.

What i get is:

00:17:43,578 ERROR [CommonsMultipartRequestHandler] Failed to parse multipart request
org.apache.commons.fileupload.FileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:384)
at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:268)
at org.apache.struts.upload.CommonsMultipartRequestHandler.handleRequest(CommonsMultipartRequestHandler.java:185)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:405)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:818)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:194)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

-------------------------------------------------------------------
User sees no problems. The application does what user "clicks".

What really bothers me is the fact that, once user clicks on "upload", every byte must be transmited. If I click on browsers stop button, I get the above exception. After that I click on something else and see on the status bar that the browser is sending the rest of the bytes (I tested with 50 Mb). When this is done the application does what it is told to.

So, did somebody think of a way to let the user change his mind, cancel the upload, and without waiting for tens of (canceled) Megabytes to be transmited, continue as he pleases?
 
Milan Tomc
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or with other words:

Is there a way to catch this exception and let the browser know we are no more interested in de request/stream?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic