Mercurial > dive4elements > river
changeset 7139:6efa25f97f7e
issue971: Let ExportServiceImpl handle encoding parameter,
configure http-client accordingly.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 25 Sep 2013 12:21:45 +0200 |
parents | 2098ac94bebc |
children | fc42d82aa71c |
files | gwt-client/src/main/java/org/dive4elements/river/client/server/ExportServiceImpl.java |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/ExportServiceImpl.java Wed Sep 25 12:20:49 2013 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/ExportServiceImpl.java Wed Sep 25 12:21:45 2013 +0200 @@ -55,6 +55,7 @@ String locale = req.getParameter("locale"); String km = req.getParameter("km"); String fn = name + "." + type; + String enc = req.getParameter("encoding"); resp.setHeader("Content-Disposition", "attachment;filename=" + fn); @@ -74,6 +75,18 @@ Document request = ClientProtocolUtils.newOutCollectionDocument( uuid, mode, type, attr); HttpClient client = new HttpClientImpl(url, locale); + + // Set out encoding if specified. + if (enc != null) { + try { + client.setOutEncoding( + java.nio.charset.Charset.forName(enc)); + } + catch(java.nio.charset.UnsupportedCharsetException e) { + logger.warn("Unsupported encoding: " + enc); + } + } + client.collectionOut(request, uuid, mode, out); out.close();