I am downloading some files through Servlet. I want to track whether the download got completed or not through servlet.
Is there any way that i can track the downloads, whether download broke in between because of network issue or if use cancelled the download etc..
Help me out in this regard.
You will need to read data from a thread. This thread will read the file from a port just like you did for a regular file. And while reading it will use a buffer. In this setting, you can count the bytes read and use that information for tracking.
And since you are writing downloading code yourself (as far as i see), you can just catch an exception when a network/IO exception occurs.
Thanks for ur reply.
Presently we are redirecting the download url. No specific download code written.
Do you have any snippet of code which use to download the file.
I guess this example will help you a lot since all you need is there ;) :
Java Tips - How to create a download manager in Java
Thanks...I will try this out..
We tried the example. Data is getting buffered.
We want to track the download from the Web. We want to track whether user has completed the download process. How can we fullfil our requirement using this. Is there any seperated solution available.
I did not understand your problem with the example given. What is missing there? It is a Java code which means you can use it in any Java application/applet including a web application.
We have given download option in our site. Normally when user clicks on download, we get save as dialoge box which is browser rendered. When user clicks on save, it is will start downloading, In between if user cancels the operation or if there is any network issue, Here we want to track whether download is been completed or not.