changeset 8865:0d7c8c943b60 3.2.x

URL-encode URLs (potentially) containing invalid characters.
author Tom Gottfried <tom@intevation.de>
date Mon, 22 Jan 2018 16:38:32 +0100
parents fa8897698133
children f5fa2467f9c0
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedCampaignChart.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/BedloadCampaignChart.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/range/DischargeInfoDataSource.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/range/DistanceInfoDataSource.java gwt-client/src/main/java/org/dive4elements/river/client/client/ui/sq/SQCampaignChart.java
diffstat 5 files changed, 32 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- 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);
--- 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);
--- 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;
     }
--- 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;
     }
--- 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);

http://dive4elements.wald.intevation.org