labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simo...@apache.org
Subject svn commit: r793113 - /labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/OnDemandBinder.java
Date Fri, 10 Jul 2009 21:24:38 GMT
Author: simoneg
Date: Fri Jul 10 21:24:20 2009
New Revision: 793113

URL: http://svn.apache.org/viewvc?rev=793113&view=rev
Log:
LABS-379 : Rewritten cookie support

Modified:
    labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/OnDemandBinder.java

Modified: labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/OnDemandBinder.java
URL: http://svn.apache.org/viewvc/labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/OnDemandBinder.java?rev=793113&r1=793112&r2=793113&view=diff
==============================================================================
--- labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/OnDemandBinder.java
(original)
+++ labs/magma/trunk/foundation-website/src/main/java/org/apache/magma/website/utils/OnDemandBinder.java
Fri Jul 10 21:24:20 2009
@@ -26,7 +26,7 @@
 	
 	private HttpSession session;
 	private Cookie[] cookies;
-	private Set<String> cleanedCookies = null;
+	private Map<String,String> newCookies = null;
 	
 	private Map<String, Object> unconvertedSession = new HashMap<String, Object>();
 	
@@ -122,7 +122,7 @@
 	}
 
 	private Object fetchCookie(String rawname, Class type) {
-		if (cleanedCookies != null && cleanedCookies.contains(rawname)) return null;
+		if (newCookies != null && newCookies.containsKey(rawname)) return convertFetch(newCookies.get(rawname),
type);
 		
 		if (cookies == null)
 			cookies = req.getCookies();
@@ -222,10 +222,6 @@
 		if (cookies == null)
 			cookies = req.getCookies();
 
-		if (cleanedCookies != null && cleanedCookies.contains(rawname)) {
-			cleanedCookies.remove(rawname);
-		}
-		
 		Cookie mycookie = null;
 		if (cookies != null) {		
 			for (Cookie cookie : cookies) {
@@ -235,19 +231,19 @@
 				}
 			}
 		}
+		if (newCookies == null) newCookies = new HashMap<String, String>();
 		if (value != null) {
 			String nval = (String) convertStore(value);
 			Cookie ncookie = new Cookie(rawname, nval);
 			ncookie.setMaxAge(2592000);
 			ncookie.setPath("/");
 			resp.addCookie(ncookie);
-			if (mycookie != null) mycookie.setValue(nval);
+			newCookies.put(rawname, nval);			
 		} else if (mycookie != null && value == null) {
 			Cookie ncookie = new Cookie(rawname,"");
 			ncookie.setMaxAge(0);
 			ncookie.setPath("/");
-			if (cleanedCookies == null) cleanedCookies = new HashSet<String>();
-			cleanedCookies.add(rawname);
+			newCookies.put(rawname, null);
 			resp.addCookie(ncookie);					
 		}
 	}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message