Project

General

Profile

How to check if WFileResource is not used anymore?

Added by A L almost 4 years ago

Hi,

I have a WFileResource that is created on demand,

and downloaded with

wApp->redirect(fileResourcePtr->url());

Now I would like to delete it, when no longer needed.

But after reading twice the documentation

of WResource hierarchy, I have no idea how to

check if e.g. WFileResource has been already downloaded

by the client. Is there a way to do this?

Thanks and best wishes,

Adrian


Replies (2)

RE: How to check if WFileResource is not used anymore? - Added by Roel Standaert almost 4 years ago

That's indeed not something WResource keeps track of by default. You could hook into handleRequest() to see if that's been called. Note: don't try to delete the resource in handleRequest(). You'll have to defer the deletion.

RE: How to check if WFileResource is not used anymore? - Added by A L almost 4 years ago

OK, thanks --- I'll try to this.

BTW, Wt is great.

Best wishes,

Adrian

    (1-2/2)