users@glassfish.java.net

how to make a servlet detect if a connection is aborted

From: <glassfish_at_javadesktop.org>
Date: Sun, 23 Nov 2008 17:32:09 PST

Hello,

Recently I made a file upload servlet with commons fileupload. This servlet gets an image, and resizes the image and does certain operations on it. I also made a button on the web page, so it can call xhr.abort() to cancel the file upload.

I need to figure out a way, if the POST terminates unexpectedly (the user clicks the abort button)
the servlet detects this so it can delete resized files and original files, etc. (the user may click even after the file upload is finished, the servlet will return the response only after the images are resized)

I did some experimenting but failed. response.getWriter().checkError() always returns false, even if the user cancels the xhr request.

any ideas?

Best regards,
-c.b.
[Message sent by forum member 'cambazz' (cambazz)]

http://forums.java.net/jive/thread.jspa?messageID=318335