Could you do something like:

Response.entity(new FileInputStream(responseBody) {
   public void close() throws IOException {
       super.close();
       responseBody.delete();
   }
};

Thus, when the stream is closed, the file would get deleted.

Dan


On Monday 18 August 2008 12:25:59 pm Brad wrote:
> Hi all,
>
> I've run into a bit of a problem with removing temp files that have
> been set as the response entity. We are writing large files to disk
> and them setting them as the response entity but obviously without a
> way to delete them they will steadily increase in number. I've had a
> look through the API and I can't see any way of telling it to delete
> the file after it has been streamed to the client.
>
> Is there any way to do this? Something along the lines of
> Response.entity(File responseBody, boolean deleteAfter).
>
> Thanks,
> Brad,.



-- 
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to