You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by kn...@apache.org on 2010/08/01 23:31:39 UTC

svn commit: r981322 - in /wicket/trunk/wicket/src/main/java/org/apache/wicket: protocol/http/servlet/ServletWebRequest.java util/cookies/CookieUtils.java

Author: knopp
Date: Sun Aug  1 21:31:39 2010
New Revision: 981322

URL: http://svn.apache.org/viewvc?rev=981322&view=rev
Log:
Fix for cookie path

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java?rev=981322&r1=981321&r2=981322&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java Sun Aug  1 21:31:39 2010
@@ -121,7 +121,13 @@ public class ServletWebRequest extends W
 		return Url.parse(Strings.stripJSessionId(url.toString()), getCharset());
 	}
 
-	protected String getFilterPrefix()
+
+	/**
+	 * Returns the prefix of Wicket filter (without the leading /)
+	 * 
+	 * @return Wicket filter prefix
+	 */
+	public String getFilterPrefix()
 	{
 		return filterPrefix;
 	}

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java?rev=981322&r1=981321&r2=981322&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java Sun Aug  1 21:31:39 2010
@@ -17,7 +17,6 @@
 package org.apache.wicket.util.cookies;
 
 import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
 
 import org.apache.wicket.markup.html.form.FormComponent;
 import org.apache.wicket.protocol.http.servlet.ServletWebRequest;
@@ -328,12 +327,10 @@ public class CookieUtils
 			cookie.setDomain(domain);
 		}
 
-		HttpServletRequest request = ((ServletWebRequest)getWebRequest()).getHttpServletRequest();
-		String path = request.getContextPath() + request.getServletPath();
-		if (Strings.isEmpty(path))
-		{
-			path = "/";
-		}
+		ServletWebRequest request = (ServletWebRequest)getWebRequest();
+		String path = request.getHttpServletRequest().getContextPath() + "/" +
+			request.getFilterPrefix();
+
 		cookie.setPath(path);
 		cookie.setVersion(settings.getVersion());
 		cookie.setSecure(settings.getSecure());