[PATCH 3 of 8] issue971: Let ChartOutputServiceImpl interprete an "encoding" parameter

Wald Commits scm-commit at wald.intevation.org
Wed Sep 25 12:16:56 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1380102534 -7200
# Node ID fd8b27cdf498ac250eebe847d8481f0ad5b16afa
# Parent  7c3cab9330c41b7491d469104cfb99ad213d1b7f
issue971: Let ChartOutputServiceImpl interprete an "encoding" parameter.

diff -r 7c3cab9330c4 -r fd8b27cdf498 gwt-client/src/main/java/org/dive4elements/river/client/server/ChartOutputServiceImpl.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/ChartOutputServiceImpl.java	Wed Sep 25 11:48:10 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/ChartOutputServiceImpl.java	Wed Sep 25 11:48:54 2013 +0200
@@ -52,9 +52,10 @@
 
             String url = getServletContext().getInitParameter("server-url");
 
-            String uuid   = req.getParameter("uuid");
-            String type   = req.getParameter("type");
-            String locale = req.getParameter("locale");
+            String uuid     = req.getParameter("uuid");
+            String type     = req.getParameter("type");
+            String locale   = req.getParameter("locale");
+            String encoding = req.getParameter("encoding");
 
             prepareHeader(req, resp);
 
@@ -63,6 +64,16 @@
                 ChartServiceHelper.getChartAttributes(prepareChartAttributes(req)));
 
             HttpClient client = new HttpClientImpl(url, locale);
+
+            if (encoding != null) {
+                try {
+                client.setOutEncoding(
+                    java.nio.charset.Charset.forName(encoding));
+                }
+                catch(java.nio.charset.UnsupportedCharsetException e) {
+                    logger.warn("Unsupported encoding: " + encoding);
+                }
+            }
             client.collectionOut(request, uuid, "chart", out);
 
             out.close();


More information about the Dive4elements-commits mailing list