• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

File creation on Serverside

 
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic