I have a Web application running on Apache - Tomcat Server. With the link provided on the html page (rendered to the user by the server) user can download static file from the server. I want to count the number of times that file has downloaded successfuly.
File download unsuccessful scenarios.
File Download popup will open when user tries to download file with options as 'Open', 'Save' and 'Cancel'
Scenario 1. User may press 'Cancel' button. Scenario 2. User pressed 'Save' but while save was going on user pressed cancel button i.e. user stoped the save process in between.
as you use tomcat and you need to count the downloads that has made froman static page you can use a servlet filter. filter will apply just on the url of your download able file. there you can count the total number of downloads.
there should be some other ways that i am not aware , but the above will solve the problem.
But I guess this will not solve my problem because the criteria for the successful download is not only the clicking of URL but I have to ensure that file has been successfuly saved on the user's system. With the filter approach I can create the response object and can have a handle to control the user response of ('Save' Or 'Cancel') but when the data will be copied from response to user system and then user presed cancel button, I will not be having any handle at that time. Make me correct if I am wrong
Hi, Not very sure this will help you. My suggestion is just give an alert to the user after the download completes saying something like is the download was successful. If the user clicks yes then you can take that response and increase your file download count.
Joined: Jun 07, 2006
This will realy help me if I am able to get the alert after the download is complete. I am not sure how to get the alert after the download is complete. Please explain me how to get the alert message.