Author: medgar
Date: Wed May 20 02:52:36 2009
New Revision: 776528
URL: http://svn.apache.org/viewvc?rev=776528&view=rev
Log:
CLK-536
Modified:
incubator/click/trunk/click/framework/src/org/apache/click/Page.java
Modified: incubator/click/trunk/click/framework/src/org/apache/click/Page.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/Page.java?rev=776528&r1=776527&r2=776528&view=diff
==============================================================================
--- incubator/click/trunk/click/framework/src/org/apache/click/Page.java (original)
+++ incubator/click/trunk/click/framework/src/org/apache/click/Page.java Wed May 20 02:52:36
2009
@@ -1113,7 +1113,19 @@
setRedirect(pageClass, null);
}
- public void setRedirect(String location, Map params){
+ /**
+ * Set the request to redirect to the given <code>location</code> and append
+ * the map of request parameter to the location URL.
+ * <p/>
+ * The map keys will be used as the request parameter names and the map
+ * values will be used as the request parameter names.
+ *
+ * @see #setRedirect(java.lang.String)
+ *
+ * @param location the path to redirect the request to
+ * @param params the map of request parameter name and value pairs
+ */
+ public void setRedirect(String location, Map params) {
if (StringUtils.isNotBlank(location)) {
if (location.charAt(0) == '/') {
Context context = getContext();
@@ -1141,13 +1153,30 @@
}
if (buffer.length() > 0) {
- location += "?" + buffer.toString();
+ if (location.contains("?")) {
+ location += "&" + buffer.toString();
+ } else {
+ location += "?" + buffer.toString();
+ }
}
}
redirect = location;
}
+ /**
+ * Set the request to redirect to the give page class and and append
+ * the map of request parameter to the location URL.
+ * <p/>
+ * The map keys will be used as the request parameter names and the map
+ * values will be used as the request parameter names.
+ *
+ * @see #setRedirect(java.lang.String)
+ * @param pageClass the class of the Page to redirect the request to
+ * @param params the map of request parameter name and value pairs
+ * @throws IllegalArgumentException if the Page Class is not configured
+ * with a unique path
+ */
public void setRedirect(Class pageClass, Map params) {
String target = getContext().getPagePath(pageClass);
|