On May 25, 2009, at 3:07 PM, Oscar Westra van Holthe - Kind wrote:

>> I'm already doing exactly as you said (skip processing and redirect  
>> to
>> result page immediately) in my submit handler by looking at the  
>> status
>> of the order.  If the status is Submitted, I'm just showing the  
>> result
>> page.  But for this to work properly, I have to obtain a pessimistic
>> lock on the order at the beginning of the request.
>
> Or, update the order status in a transaction first, and then process  
> the
> order in a second transaction afterwards. Especially with a  
> transaction
> isolation of "serializable", this will ensure a second request can  
> only read
> the updated order status.

Hmmm.  I think this is still problematic.  The second request would  
see the "submitted" status on the order, so it would bypass the  
processing and show the result page.  This could happen before the  
first request finished all of its work. The result page wouldn't have  
the correct information.

>> I'm curious how amazon handles this.  I tried double-submitting some
>> forms on their site, but it seems like they either somehow abort all
>> but the last request or have a filter that caches the first  
>> submission
>> and shows it on subsequent requests.  I'm not sure how they would  
>> have
>> a filter, though, because there is no hidden token in the form.
>
> Instead of a token, you can also hash the request. This would  
> eliminate the
> need to send a token to the browser. Add to that that the hash would  
> also
> include the session (with data like the last page view for an  
> ActionBean),
> and duplicate requests will have identical hashes.

Good point - I hadn't thought of this.



------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to