You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jc...@apache.org on 2008/05/11 19:07:42 UTC

svn commit: r655339 - in /wicket/branches/wicket-1.3.x/jdk-1.4/wicket: ./ src/main/java/org/apache/wicket/protocol/http/WicketFilter.java

Author: jcompagner
Date: Sun May 11 10:07:42 2008
New Revision: 655339

URL: http://svn.apache.org/viewvc?rev=655339&view=rev
Log:
WICKET-1569 AjaxButton break form data when IRequestSettings.#getResponseRequestEncoding is not UTF-8.

Modified:
    wicket/branches/wicket-1.3.x/jdk-1.4/wicket/   (props changed)
    wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java

Propchange: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun May 11 10:07:42 2008
@@ -1 +1 @@
-/wicket/trunk/wicket:647219,654055,655101,655115,655118,655295,655297
+/wicket/trunk/wicket:647219,654055,655101,655115,655118,655295,655297,655329

Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java?rev=655339&r1=655338&r2=655339&view=diff
==============================================================================
--- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java (original)
+++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java Sun May 11 10:07:42 2008
@@ -299,12 +299,24 @@
 			{
 				try
 				{
-					// The encoding defined by the wicket settings is used to
-					// encode the responses. Thus, it is reasonable to assume
-					// the request has the same encoding. This is especially
-					// important for forms and form parameters.
-					servletRequest.setCharacterEncoding(webApplication.getRequestCycleSettings()
-						.getResponseRequestEncoding());
+					// It this request is a wicket-ajax request, we need decode the
+					// request always by UTF-8, because the request data is encoded by
+					// encodeUrlComponent() JavaScript function, which always encode data
+					// by UTF-8.
+					String wicketAjaxHeader = servletRequest.getHeader("wicket-ajax");
+					if (wicketAjaxHeader != null && wicketAjaxHeader.equals("true"))
+					{
+						servletRequest.setCharacterEncoding("UTF-8");
+					}
+					else
+					{
+						// The encoding defined by the wicket settings is used to
+						// encode the responses. Thus, it is reasonable to assume
+						// the request has the same encoding. This is especially
+						// important for forms and form parameters.
+						servletRequest.setCharacterEncoding(webApplication.getRequestCycleSettings()
+							.getResponseRequestEncoding());
+					}
 				}
 				catch (UnsupportedEncodingException ex)
 				{