Author: mgrigorov Date: Tue May 10 20:49:12 2011 New Revision: 1101639 URL: http://svn.apache.org/viewvc?rev=1101639&view=rev Log: Log a warning when a <form method="get"> is used as multipart and set the method to POST.
Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java Modified: wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java?rev=1101639&r1=1101638&r2=1101639&view=diff ============================================================================== --- wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java (original) +++ wicket/trunk/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java Tue May 10 20:49:12 2011 @@ -21,6 +21,7 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import org.apache.wicket.Component; @@ -1412,7 +1413,7 @@ public class Form<T> extends WebMarkupCo if (isRootForm()) { - String method = getMethod().toLowerCase(); + String method = getMethod().toLowerCase(Locale.ENGLISH); tag.put("method", method); String url = getActionUrl().toString(); if (encodeUrlInHiddenFields()) @@ -1432,6 +1433,16 @@ public class Form<T> extends WebMarkupCo if (isMultiPart()) { + if (METHOD_GET.equalsIgnoreCase(method)) + { + if (log.isWarnEnabled()) + { + log.warn(String.format( + "Form with id '%s' is multipart. It should use method 'POST'!", getId())); + } + tag.put("method", METHOD_POST.toLowerCase(Locale.ENGLISH)); + } + tag.put("enctype", "multipart/form-data"); // // require the application-encoding for multipart/form-data to be sure to