changeset 7136:fd8b27cdf498

issue971: Let ChartOutputServiceImpl interprete an "encoding" parameter.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 25 Sep 2013 11:48:54 +0200
parents 7c3cab9330c4
children 4c99b8783e1d
files gwt-client/src/main/java/org/dive4elements/river/client/server/ChartOutputServiceImpl.java
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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();

http://dive4elements.wald.intevation.org