You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2010/01/19 01:26:09 UTC

svn commit: r900619 - /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java

Author: ivaynberg
Date: Tue Jan 19 00:26:09 2010
New Revision: 900619

URL: http://svn.apache.org/viewvc?rev=900619&view=rev
Log:
WICKET-2312
Issue: WICKET-2312

Modified:
    wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java

Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java?rev=900619&r1=900618&r2=900619&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java Tue Jan 19 00:26:09 2010
@@ -253,9 +253,16 @@
 		boolean portletRequest = requestContext.isPortletRequest();
 		boolean sharedResourceURL = false;
 
+		boolean isAjax = ((WebRequestCycle)requestCycle).getWebRequest().isAjax();
+		boolean skipRelativePathPrefix = false;
+
 		if (url != null && !portletRequest)
 		{
-			// Do nothing - we've found the URL and it's mounted.
+			// We've found the URL and it's mounted.
+
+			// In the case of Ajax, we don't want to prepend a relative path
+			// to the mounted URL. See WICKET-2312.
+			skipRelativePathPrefix = isAjax;
 		}
 		else if (requestTarget instanceof IBookmarkablePageRequestTarget)
 		{
@@ -299,7 +306,7 @@
 				else if (IRedirectListener.class.isAssignableFrom(rli.getMethod()
 					.getDeclaringClass()))
 				{
-					if (((WebRequestCycle)requestCycle).getWebRequest().isAjax())
+					if (isAjax)
 					{
 						// TODO: Probably not all Ajax based redirects need to break out of
 						// ResourceURL encoding
@@ -353,7 +360,8 @@
 		if (url != null)
 		{
 			String result = null;
-			if (!UrlUtils.isRelative(url.toString()) || (!sharedResourceURL && portletRequest))
+			if (!UrlUtils.isRelative(url.toString()) || (!sharedResourceURL && portletRequest) ||
+				skipRelativePathPrefix)
 			{
 				result = url.toString();
 			}