File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes problem with download prompt cancel button Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "problem with download prompt cancel button" Watch "problem with download prompt cancel button" New topic
Author

problem with download prompt cancel button

saipraneeth nallapareddy
Ranch Hand

Joined: Dec 02, 2009
Posts: 159
hello everyone,

I am developing an application when user clicks on a button by selecting a file it shows the download prompt with Open/Save/Cancel, Open and Save are working fine. But when clicked on cancel button there is an error being raised on the server with network exception SocketException is being throwed.

How to handle this issue. Can anyone help me in this regard.
Michael Angstadt
Ranch Hand

Joined: Jun 17, 2009
Posts: 273

It sounds like maybe you are not properly closing the connection on the client side when Cancel is clicked.


SCJP 6 || SCWCD 5
saipraneeth nallapareddy
Ranch Hand

Joined: Dec 02, 2009
Posts: 159
no i have closed all the connections in the finally block.
Michael Angstadt
Ranch Hand

Joined: Jun 17, 2009
Posts: 273

It sounds like you are opening the connection before the user clicks any of the buttons. Maybe you should instead wait for the user to click a button to open the connection. So, if the user clicks Cancel, you can just close the dialog window and the connection will never have been opened, thus preventing that exception from being thrown on the server.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

This cancel button you're describing... is it the one which the browser displays when it decides a response is a file to be downloaded? In that case the error is perfectly normal. It's the same error which occurs when the user interrupts a large page load by clicking on some other link.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with download prompt cancel button