changeset 8864:fa8897698133 3.2.x

Encode fixation preview image-URL with GWT-means.
author Tom Gottfried <tom@intevation.de>
date Fri, 19 Jan 2018 20:30:47 +0100
parents 0862ea5d66ba
children 0d7c8c943b60
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixationPanel.java gwt-client/src/main/java/org/dive4elements/river/client/shared/MapUtils.java
diffstat 2 files changed, 6 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixationPanel.java	Thu Jan 18 20:54:03 2018 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixationPanel.java	Fri Jan 19 20:30:47 2018 +0100
@@ -9,6 +9,7 @@
 package org.dive4elements.river.client.client.ui.fixation;
 
 import com.google.gwt.core.client.GWT;
+import com.google.gwt.http.client.URL;
 import com.google.gwt.i18n.client.DateTimeFormat;
 import com.google.gwt.i18n.client.NumberFormat;
 import com.google.gwt.json.client.JSONNumber;
@@ -40,7 +41,6 @@
 import org.dive4elements.river.client.client.services.FixingsOverviewService;
 import org.dive4elements.river.client.client.services.FixingsOverviewServiceAsync;
 import org.dive4elements.river.client.client.ui.AbstractUIProvider;
-import org.dive4elements.river.client.shared.MapUtils;
 import org.dive4elements.river.client.shared.model.Data;
 import org.dive4elements.river.client.shared.model.DataList;
 import org.dive4elements.river.client.shared.model.FixAnalysisArtifact;
@@ -157,7 +157,7 @@
         overviewService.generateOverview(
             locale,
             artifact.getUuid(),
-            MapUtils.toJavaEncodedString(getOverviewFilter(art.getFilter())),
+            getOverviewFilter(art.getFilter()),
             renderCheckboxes(),
             callBack,
             new AsyncCallback<FixingsOverviewInfo>() {
@@ -297,10 +297,10 @@
             hHeight = (int)(hWidth *3f/4);
         }
 
-        String imgUrl = GWT.getModuleBaseURL();
-        imgUrl += "fixings-km-chart";
-        imgUrl += "?locale=" + locale;
-        imgUrl += "&filter=" + getChartFilter(filter, hWidth, hHeight);
+        String imgUrl = URL.encode(GWT.getModuleBaseURL()
+            + "fixings-km-chart"
+            + "?locale=" + locale
+            + "&filter=" + getChartFilter(filter, hWidth, hHeight));
 
         if (chartContainer.hasMember(chartImg)) {
             chartImg.setWidth(hWidth);
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/MapUtils.java	Thu Jan 18 20:54:03 2018 +0100
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/MapUtils.java	Fri Jan 19 20:30:47 2018 +0100
@@ -51,26 +51,5 @@
 
         return url;
     }
-
-
-    public static String toJavaEncodedString(String str) {
-        if (str == null) {
-            return null;
-        }
-        StringBuilder sb = new StringBuilder();
-        for (int i = 0, len = str.length(); i < len; i++) {
-            int unipoint = Character.codePointAt(str, i);
-            if ((unipoint < 32) || (unipoint > 127)) {
-                sb.append("\\u");
-                sb.append(Integer.toHexString((unipoint >> 3*4) & 0xf));
-                sb.append(Integer.toHexString((unipoint >> 2*4) & 0xf));
-                sb.append(Integer.toHexString((unipoint >> 1*4) & 0xf));
-                sb.append(Integer.toHexString((unipoint >> 0*4) & 0xf));
-            } else {
-                sb.append(str.charAt(i));
-            }
-        }
-        return sb.toString();
-    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org