aspose file tools*
The moose likes Servlets and the fly likes Keeping count of downloaded file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Keeping count of downloaded file" Watch "Keeping count of downloaded file" New topic
Author

Keeping count of downloaded file

Yasser Sultan
Greenhorn

Joined: Sep 23, 2008
Posts: 2
Hi,
I have written a servlet for downloading file from the webpage. This servlet updates the total number of downloads once the download is successfully completed. I am using outputstream of the response to write the data into. The problem is when I click the href link in the browser (Either firefox or ie) the browser displays a dialogbox asking me to either open the file using a program or to save in a location. But in the meantime the server is sending data to the client's system. So if the file size is small, say 2KB then the download is already finished till I press OK or Cancel in the dialogbox. Thus even if the client presses cancel button of the dialog box the servlet has incremented the number of downloads for the file, which is wrong.

Therefore I want that the download should start only when the user clicks on the OK button of the dialogbox.

Please help me out.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60046
    
  65

You are not going to be able to change the browser's behavior.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Keeping count of downloaded file
 
Similar Threads
Counting Number of downloads of Static file
1 minute issue when creating excel file using JXL
1 minute issue when creating excel file using JXL
Issue with IE downloading excel
Opening Excel sheet in a browser