Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
I'm pretty sure that this is a dumb question, but I've been Googling around for a while, and can't think what to search for...
Basically, I'm working on a Struts Interceptor, for handling multiple submits. I'm using the Synchronizer Token design pattern; saving a simple number on the client page, and in the session. Upon the submit I check that the numbers match, and, if so, increment the number in the session. Then I have a custom tag which gets that incremented number when it renders the next JSP page. The predictability of simply incrementing numbers has been considered, and is not a problem for us.
I think (hope) that's all sensible, and is well documented in various places talking about the Synchronizer Token pattern. What I'm stuck on is how to handle the case when the values don't match. I want to store the response that was sent back the first time, and, upon hitting the interceptor with a previous 'token', pull out that response and re-send it, without needing to go any further into my application. My question is simply: where and how do I store that response.
I'm pretty new to Servlets (and JEE in general), but have a few years of core Java, and JSE experience. Can I just keep a map somewhere with key=value of token=response? Is that safe for threads / multiple servers / etc, etc? If not - what's better?!
Thanks Ashok, but sorry, I don't fully understand your response. Do you mean to just repeat the same functionality that was used for the original request? That's what we're trying to avoid really - if we've already generated the response, we want to just return it from the interceptor, without having to go any further.
Sorry if I mis-understood what you meant!
Enjoy the full beauty of the english language. Embedded in this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth