The only way to make a link go away is to make it dynamic. That means that
the link you email will have to be to an action that returns the file. There
have been quite a few threads recently on this mailing list about how to get
actions to return files, including .pdf and .csv, so I won't cover that
here.

Here is a list of steps for how I would go about implementing this feature:

1 - generate a unique token and store it in the database with a
timestamp=now() and status=valid.
2 - add this token to the url you send in the email:
http://www.mycompany.com/myapp/download.do?token=123abc
3 - when the user calls the action via the supplied url, the action checks
the database to see if the token is still valid.
4 - if token is valid, send the file, and then invalidate the token so it
can't be used again. (status=used)
5 - if token not valid, display a message to the user telling them that the
link has either expired or already been used.
6 - have a background process run periodically (1 per day, every hour,
whatever) that checks the timestamps in the database and expires tokens if
the timestamp is more than 24 hours old. (status=expired)

The background process can be run via Quartz, which was also covered
recently in this list.

Wiebe de Jong

-----Original Message-----
From: Richard [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 13, 2004 2:14 AM
To: Struts Users Mailing List
Subject: sending/maintaning a download link

hi guys,

how do i do this in struts?

i want to send a download link ( via email - resolved ) to a newly
registered user and that download link will expire after 24hrs.

is there and apache project for this?

please help

thanks in advance
richard

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to