# HG changeset patch # User Tom Gottfried # Date 1516390247 -3600 # Node ID fa88976981332c520dee48866bfc4ba02c8f01f0 # Parent 0862ea5d66baf60e7eee496d130a35157cc9ec12 Encode fixation preview image-URL with GWT-means. diff -r 0862ea5d66ba -r fa8897698133 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/fixation/FixationPanel.java --- 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() { @@ -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); diff -r 0862ea5d66ba -r fa8897698133 gwt-client/src/main/java/org/dive4elements/river/client/shared/MapUtils.java --- 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 :