• Post Reply Bookmark Topic Watch Topic
  • New Topic

File creation on Serverside

 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys

There's a requirement for me to create a download functionality. I've done this before using streams but the requirement right now requires me to create a temporary, physical file on the server-side. Now once that file is created, I need to pass it to an input stream and then again to an output stream for the client to download.

My only concern is that the file, once downloaded doesn't really need to be there for a long time. I want it to be deleted once the streaming process is complete. Hmmm... Is it possible to delete the file after the Servlet has finished sending the response to the client and before the doPost or doGet method completes?


Thanks!
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you provide access to the file via a Servlet rather than allowing direct access, you can get the Servlet to provide security and restrict access, but you can also 'watch' the bytes that get sent and make sure the client receives the data, and delete the file afterwards.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!