It wouldnt survive a server restart, but this may well be acceptable if
you dont expect the server to restart very often and your token expiry
is only a day or two and its easy to get another token if needs be.
Im not sure what the deal is with stuff added to servlet context after
startup in a clustered environment however. If your in a cluster you
would need to check up on that in the docs as it may not be available to
all servers in the cluster?
Richard wrote:
> Hi Wiebe,
>
> What if im not going to use any database? can I just store this in the
> servlet context?
>
> Thanks
> Richard
>
>
> On Wed, 13 Oct 2004 10:12:38 -0700, Wiebe de Jong <wiebedj@shaw.ca> wrote:
>
>>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:richards.list@gmail.com]
>>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: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
|