cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brad <...@javawork.co.uk>
Subject Re: JAXRS: passing temp files to ResponseBuilder.entityt()
Date Tue, 19 Aug 2008 09:20:21 GMT
Dan,

good thinking there, that has done the trick.

Thanks,
Brad.

On Mon, Aug 18, 2008 at 5:33 PM, Daniel Kulp <dkulp@apache.org> wrote:
>
>
> 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
> dkulp@apache.org
> http://www.dankulp.com/blog
>

Mime
View raw message