Revision: 990
          http://stripes.svn.sourceforge.net/stripes/?rev=990&view=rev
Author:   bengunter
Date:     2008-10-22 19:01:48 +0000 (Wed, 22 Oct 2008)

Log Message:
-----------
Applied fix for STS-557 from the trunk.

Modified Paths:
--------------
    
branches/1.5.x/stripes/src/net/sourceforge/stripes/mock/MockHttpServletResponse.java

Modified: 
branches/1.5.x/stripes/src/net/sourceforge/stripes/mock/MockHttpServletResponse.java
===================================================================
--- 
branches/1.5.x/stripes/src/net/sourceforge/stripes/mock/MockHttpServletResponse.java
        2008-10-22 19:00:52 UTC (rev 989)
+++ 
branches/1.5.x/stripes/src/net/sourceforge/stripes/mock/MockHttpServletResponse.java
        2008-10-22 19:01:48 UTC (rev 990)
@@ -19,6 +19,7 @@
 import javax.servlet.ServletOutputStream;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.util.ListIterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.HashMap;
@@ -50,8 +51,17 @@
     private String redirectUrl;
 
     /** Adds a cookie to the set of cookies in the response. */
-    public void addCookie(Cookie cookie) { this.cookies.add(cookie); }
+    public void addCookie(Cookie cookie) {
+        // Remove existing cookies with the same name as the new one
+        ListIterator<Cookie> iterator = cookies.listIterator();
+        while (iterator.hasNext()) {
+            if (iterator.next().getName().equals(cookie.getName()))
+                iterator.remove();
+        }
 
+        this.cookies.add(cookie);
+    }
+
     /** Gets the set of cookies stored in the response. */
     public Cookie[] getCookies() { return this.cookies.toArray(new 
Cookie[this.cookies.size()]); }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to