users@jersey.java.net

Re: [Jersey] Callback hook for when http response finished?

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Wed, 08 Jul 2009 20:52:30 -0400

You could write a new MessageBodyWriter<File> to override the default
one. Once you finish writing the last byte to the output stream you
can delete the temp file.

Marc.

On Jul 8, 2009, at 7: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
>