You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2010/09/12 11:31:57 UTC

svn commit: r996277 - /wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java

Author: mgrigorov
Date: Sun Sep 12 09:31:56 2010
New Revision: 996277

URL: http://svn.apache.org/viewvc?rev=996277&view=rev
Log:
WICKET-3032 WebApplication#mountBookmarkablePage with unicode path not works.

Use IRequestCycleSettings#getResponseRequestEncoding() to encode the mount path for url coding strategies


Modified:
    wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java

Modified: wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java?rev=996277&r1=996276&r2=996277&view=diff
==============================================================================
--- wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java (original)
+++ wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/request/target/coding/AbstractRequestTargetUrlCodingStrategy.java Sun Sep 12 09:31:56 2010
@@ -59,7 +59,8 @@ public abstract class AbstractRequestTar
 		{
 			throw new IllegalArgumentException("Mount path cannot be null or empty");
 		}
-		this.mountPath = mountPath.startsWith("/") ? mountPath.substring(1) : mountPath;
+		this.mountPath = initMountPath(mountPath);
+
 		if (this.mountPath.startsWith("resources/") || this.mountPath.equals("resources"))
 		{
 			throw new IllegalArgumentException("Mount path cannot be under '/resources'");
@@ -67,6 +68,22 @@ public abstract class AbstractRequestTar
 	}
 
 	/**
+	 * Encodes the meaningful part of <code>mountPath</code> using
+	 * org.apache.wicket.settings.IRequestCycleSettings.getResponseRequestEncoding() or "UTF-8" if
+	 * there is no default encoding configured
+	 * 
+	 * @param mountPath
+	 *            the mount path to encode
+	 * @return the encoded mount path without the leading '/' if there is such
+	 */
+	private String initMountPath(final String mountPath)
+	{
+		final String path = mountPath.startsWith("/") ? mountPath.substring(1) : mountPath;
+		final String encodedPath = WicketURLEncoder.FULL_PATH_INSTANCE.encode(path);
+		return encodedPath;
+	}
+
+	/**
 	 * @see org.apache.wicket.request.target.coding.IMountableRequestTargetUrlCodingStrategy#getMountPath()
 	 */
 	public String getMountPath()