<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Struts and Synchronizer Token</title>
	<atom:link href="http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token/</link>
	<description>Agile and Programming</description>
	<lastBuildDate>Wed, 08 Feb 2012 12:12:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Anders</title>
		<link>http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token/comment-page-1/#comment-26759</link>
		<dc:creator>Anders</dc:creator>
		<pubDate>Thu, 24 Nov 2005 11:06:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token#comment-26759</guid>
		<description>It&#039;s not much more code you need than what&#039;s in the blogentry. You just have to grok how to incorporate it into your own code. Read the docs people.</description>
		<content:encoded><![CDATA[<p>It&#8217;s not much more code you need than what&#8217;s in the blogentry. You just have to grok how to incorporate it into your own code. Read the docs people.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amey</title>
		<link>http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token/comment-page-1/#comment-24815</link>
		<dc:creator>Amey</dc:creator>
		<pubDate>Wed, 09 Nov 2005 13:20:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token#comment-24815</guid>
		<description>Does ne 1 have a working code for synchronizer token? I am new to Struts. 
Your help is appreciated. 
I was pulling my hair off for this prob..
Thanks
Amey.</description>
		<content:encoded><![CDATA[<p>Does ne 1 have a working code for synchronizer token? I am new to Struts.<br />
Your help is appreciated.<br />
I was pulling my hair off for this prob..<br />
Thanks<br />
Amey.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token/comment-page-1/#comment-14781</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Wed, 31 Aug 2005 13:59:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token#comment-14781</guid>
		<description>The technical part of this can be easily implemented.  For each form, there are two random keys.  1 key is used as key, while another as value.  They are stored as hidden field, and also in the session object.  When user submit, the system sync the session, use the 1st key to look up for the 2nd.  If found, then remove both from the session.  If not, then this is a resubmit.  The next time the form is requested, a new pair of keys is generated.  The only problem with this is that memory may get leaked.  A simple solution is to limit the number of keys per form.  Another is to have it removed after certain wait time.</description>
		<content:encoded><![CDATA[<p>The technical part of this can be easily implemented.  For each form, there are two random keys.  1 key is used as key, while another as value.  They are stored as hidden field, and also in the session object.  When user submit, the system sync the session, use the 1st key to look up for the 2nd.  If found, then remove both from the session.  If not, then this is a resubmit.  The next time the form is requested, a new pair of keys is generated.  The only problem with this is that memory may get leaked.  A simple solution is to limit the number of keys per form.  Another is to have it removed after certain wait time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token/comment-page-1/#comment-5240</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Fri, 15 Apr 2005 18:37:52 +0000</pubDate>
		<guid isPermaLink="false">http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token#comment-5240</guid>
		<description>As dan said, there is only one way to solve this.

Restrict the user to work on one page at a time.
When token is issued to the user, store it in Session, irrespective of whether last token was sent back by the user.

In this way, if user open new window a new token is issued to him, and the last one becomes invalid. and so the first window form.

hope this helps 
</description>
		<content:encoded><![CDATA[<p>As dan said, there is only one way to solve this.</p>
<p>Restrict the user to work on one page at a time.<br />
When token is issued to the user, store it in Session, irrespective of whether last token was sent back by the user.</p>
<p>In this way, if user open new window a new token is issued to him, and the last one becomes invalid. and so the first window form.</p>
<p>hope this helps</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dan</title>
		<link>http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token/comment-page-1/#comment-1789</link>
		<dc:creator>dan</dc:creator>
		<pubDate>Tue, 08 Mar 2005 15:54:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token#comment-1789</guid>
		<description>I have implemented a locking on the session as a whole so that only one request can be done per user. This loses some performance on read-only calls that could have been served, but I am willing to trade that in in exchange for maintenance and simplicity. The code I use is:

&lt;code&gt;
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
	{
		if (sessionLock.lock(request))
		{
			try
			{
				ActionForward af = super.execute(mapping, form, request, response);
		
				return af;
			}
			catch (Exception e)
			{
				throw e;
			}
			finally
			{
				sessionLock.unlock(request);
			}
		}
		
		// should be a nice page asking user to be patient
		return null;
	}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I have implemented a locking on the session as a whole so that only one request can be done per user. This loses some performance on read-only calls that could have been served, but I am willing to trade that in in exchange for maintenance and simplicity. The code I use is:</p>
<p><code><br />
	public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception<br />
	{<br />
		if (sessionLock.lock(request))<br />
		{<br />
			try<br />
			{<br />
				ActionForward af = super.execute(mapping, form, request, response);</p>
<p>				return af;<br />
			}<br />
			catch (Exception e)<br />
			{<br />
				throw e;<br />
			}<br />
			finally<br />
			{<br />
				sessionLock.unlock(request);<br />
			}<br />
		}</p>
<p>		// should be a nice page asking user to be patient<br />
		return null;<br />
	}<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anders</title>
		<link>http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token/comment-page-1/#comment-21</link>
		<dc:creator>Anders</dc:creator>
		<pubDate>Tue, 31 Aug 2004 06:51:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token#comment-21</guid>
		<description>I&#039;m completely aware of it, and I&#039;ve been playing around with the thought of contributing. But right now I can&#039;t really find the time to. I wish I could though. :)</description>
		<content:encoded><![CDATA[<p>I&#8217;m completely aware of it, and I&#8217;ve been playing around with the thought of contributing. But right now I can&#8217;t really find the time to. I wish I could though. <img src='http://blog.f12.no/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig McClanahan</title>
		<link>http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token/comment-page-1/#comment-20</link>
		<dc:creator>Craig McClanahan</dc:creator>
		<pubDate>Tue, 31 Aug 2004 04:13:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.f12.no/wp/2004/08/30/struts-and-synchronizer-token#comment-20</guid>
		<description>It is much more likely that such a feature would be implemented if someone (especially someone who believed it to be &quot;not a big problem&quot; to implement :-) were to file an enhancement request in the bug tracking system, and then add a patch (as an attachment) that implements the requested feature.</description>
		<content:encoded><![CDATA[<p>It is much more likely that such a feature would be implemented if someone (especially someone who believed it to be &#8220;not a big problem&#8221; to implement <img src='http://blog.f12.no/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  were to file an enhancement request in the bug tracking system, and then add a patch (as an attachment) that implements the requested feature.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

