[PATCH] URL-encode URLs (potentially) containing invalid characters
Wald Commits
scm-commit at wald.intevation.org
Mon Jan 22 16:39:43 CET 2018
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1516635512 -3600
# Branch 3.2.x
# Node ID 0d7c8c943b608989f463b856399f580cd784b3d5
# Parent fa88976981332c520dee48866bfc4ba02c8f01f0
URL-encode URLs (potentially) containing invalid characters.
diff -r fa8897698133 -r 0d7c8c943b60 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedCampaignChart.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedCampaignChart.java Fri Jan 19 20:30:47 2018 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedCampaignChart.java Mon Jan 22 16:38:32 2018 +0100
@@ -9,6 +9,7 @@
package org.dive4elements.river.client.client.ui.minfo;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.http.client.URL;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
@@ -68,10 +69,10 @@
jfix.put("bed", jfilter);
String filter = jfix.toString();
- String imgUrl = GWT.getModuleBaseURL();
- imgUrl += "bed-km-chart";
- imgUrl += "?locale=" + locale;
- imgUrl += "&filter=" + filter;
+ String imgUrl = URL.encode(GWT.getModuleBaseURL()
+ + "bed-km-chart"
+ + "?locale=" + locale
+ + "&filter=" + filter);
if (chartImg != null && hasMember(chartImg)) {
chartImg.setWidth(hWidth);
diff -r fa8897698133 -r 0d7c8c943b60 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedloadCampaignChart.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedloadCampaignChart.java Fri Jan 19 20:30:47 2018 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedloadCampaignChart.java Mon Jan 22 16:38:32 2018 +0100
@@ -9,6 +9,7 @@
package org.dive4elements.river.client.client.ui.minfo;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.http.client.URL;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
@@ -71,10 +72,10 @@
jfix.put("bedload", jfilter);
String filter = jfix.toString();
- String imgUrl = GWT.getModuleBaseURL();
- imgUrl += "bedload-km-chart";
- imgUrl += "?locale=" + locale;
- imgUrl += "&filter=" + filter;
+ String imgUrl = URL.encode(GWT.getModuleBaseURL()
+ + "bedload-km-chart"
+ + "?locale=" + locale
+ + "&filter=" + filter);
if (chartImg != null && hasMember(chartImg)) {
chartImg.setWidth(hWidth);
diff -r fa8897698133 -r 0d7c8c943b60 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/range/DischargeInfoDataSource.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/range/DischargeInfoDataSource.java Fri Jan 19 20:30:47 2018 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/range/DischargeInfoDataSource.java Mon Jan 22 16:38:32 2018 +0100
@@ -9,6 +9,7 @@
package org.dive4elements.river.client.client.ui.range;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.http.client.URL;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.DataSourceField;
@@ -43,11 +44,11 @@
protected String getServiceURL(String server, long gauge, String river) {
- String url = GWT.getModuleBaseURL();
- url += "dischargeinfoxml";
- url += "?server=" + server;
- url += "&gauge=" + String.valueOf(gauge);
- url += "&river=" + river;
+ String url = URL.encode(GWT.getModuleBaseURL()
+ + "dischargeinfoxml"
+ + "?server=" + server
+ + "&gauge=" + String.valueOf(gauge)
+ + "&river=" + river);
return url;
}
diff -r fa8897698133 -r 0d7c8c943b60 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/range/DistanceInfoDataSource.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/range/DistanceInfoDataSource.java Fri Jan 19 20:30:47 2018 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/range/DistanceInfoDataSource.java Mon Jan 22 16:38:32 2018 +0100
@@ -9,6 +9,7 @@
package org.dive4elements.river.client.client.ui.range;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.http.client.URL;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.DataSourceField;
@@ -48,12 +49,16 @@
}
- protected String getServiceURL(String server, String river, String filter) {
- String url = GWT.getModuleBaseURL();
- url += "distanceinfoxml";
- url += "?server=" + server;
- url += "&river=" + river;
- url += "&filter=" + filter;
+ protected String getServiceURL(
+ String server,
+ String river,
+ String filter
+ ) {
+ String url = URL.encode(GWT.getModuleBaseURL()
+ + "distanceinfoxml"
+ + "?server=" + server
+ + "&river=" + river
+ + "&filter=" + filter);
return url;
}
diff -r fa8897698133 -r 0d7c8c943b60 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sq/SQCampaignChart.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sq/SQCampaignChart.java Fri Jan 19 20:30:47 2018 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sq/SQCampaignChart.java Mon Jan 22 16:38:32 2018 +0100
@@ -9,6 +9,7 @@
package org.dive4elements.river.client.client.ui.sq;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.http.client.URL;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
@@ -69,10 +70,10 @@
jfix.put("sq", jfilter);
String filter = jfix.toString();
- String imgUrl = GWT.getModuleBaseURL();
- imgUrl += "sq-km-chart";
- imgUrl += "?locale=" + locale;
- imgUrl += "&filter=" + filter;
+ String imgUrl = URL.encode(GWT.getModuleBaseURL()
+ + "sq-km-chart"
+ + "?locale=" + locale
+ + "&filter=" + filter);
if (chartImg != null && hasMember(chartImg)) {
chartImg.setWidth(hWidth);
More information about the Dive4Elements-commits
mailing list