If you are running your app on glassfish v3 or grizzly webserver, you
could use grizzly-sendfile[1] to send the tmp file to the client and
create a plugin for grizzly-sendfile that will delete the file once
the download is finished.
In our resource you would just return an empty response with the X-
Sendfile header set to the location of the tmp file.
/i
[1]
http://grizzly-sendfile.kenai.com
On Jul 8, 2009, at 4:50 PM, Chris Wilkes wrote:
> I'm building up a temp file to return to the user after they hit a
> POST
> method in jersey. I'd like to delete that temp file after the user
> has
> finished downloading the file.
>
> Is there a way to get a notification when a user has finished their
> download? I'd like to not have to change the return type of my method
> from File to do this.
>
> What do other people do in this situation? Currently I delete the
> file
> in a background thread that runs on a timer and deletes old files.
> I'm
> worried that if I rely on File.deleteOnExit() that I'll build up
> thousands of temp files.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>