This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I don't know if I am posting at right place, so my apologies if its not
I have a problem regarding removing my temporary files once they are sendt to or viewed by the client.Now I can't call delete afetr sending because I don't know till when the user clicks the save button.So I need some way to figure that out .Please help.
Thax in advance.
SCJWSD, SCBCD,SCWCD, SCJP
If I am destined to fail, then I do have a purpose in my life: To fail my destiny.
I would use a servlet in my web app to provide the file, after the file is viewed the servlet will delete it. Lets say you generate a timestamp.pdf file on the server in an specific place. You will give the user a link to the servlet and pass the servlet the timestamp (or file id) via a parameter. Then the servlet will get the file, open it with a inputstream and print it to the response.outputstream. At the end you flush the outputstream and delete the file.
This will clean up your temp files. But user can only download them once. If they try a second time they will cause an exception cause the file was deleted at the end of the first use. If this is a problem tell me, there is a second solution to the problem but maybe it will need some changes to your app.
She will remember your heart when men are fairy tales in books written by rabbits.<br /> As long as there is duct tape... there is also hope.