You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2013/10/21 06:38:28 UTC
[2/2] git commit: CAMEL-6873 support the Exchange.CHARSET_NAME header
in camel-gson, with thanks to Fergus
CAMEL-6873 support the Exchange.CHARSET_NAME header in camel-gson, with thanks to Fergus
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/561c7864
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/561c7864
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/561c7864
Branch: refs/heads/camel-2.11.x
Commit: 561c78640add46369038b442f5d0ce394324addb
Parents: 36f18c9
Author: Willem Jiang <ni...@apache.org>
Authored: Mon Oct 21 12:29:49 2013 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Mon Oct 21 12:37:45 2013 +0800
----------------------------------------------------------------------
.../java/org/apache/camel/component/gson/GsonDataFormat.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/561c7864/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java b/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
index a5537e5..fc1a0d7 100644
--- a/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
+++ b/components/camel-gson/src/main/java/org/apache/camel/component/gson/GsonDataFormat.java
@@ -94,14 +94,14 @@ public class GsonDataFormat extends ServiceSupport implements DataFormat {
@Override
public void marshal(Exchange exchange, Object graph, OutputStream stream) throws Exception {
- BufferedWriter writer = IOHelper.buffered(new OutputStreamWriter(stream));
+ BufferedWriter writer = IOHelper.buffered(new OutputStreamWriter(stream, IOHelper.getCharsetName(exchange)));
gson.toJson(graph, writer);
writer.close();
}
@Override
public Object unmarshal(Exchange exchange, InputStream stream) throws Exception {
- BufferedReader reader = IOHelper.buffered(new InputStreamReader(stream));
+ BufferedReader reader = IOHelper.buffered(new InputStreamReader(stream, IOHelper.getCharsetName(exchange)));
Object result = gson.fromJson(reader, this.unmarshalType);
reader.close();
return result;