cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r525936 - /incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Date Thu, 05 Apr 2007 19:21:57 GMT
Author: gawor
Date: Thu Apr  5 12:21:56 2007
New Revision: 525936

URL: http://svn.apache.org/viewvc?view=rev&rev=525936
Log:
send charset in content-type header (CXF-506)

Modified:
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java?view=diff&rev=525936&r1=525935&r2=525936
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
(original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/HTTPConduit.java
Thu Apr  5 12:21:56 2007
@@ -279,8 +279,15 @@
     protected void flushHeaders(Message message) throws IOException {
         URLConnection connection = (URLConnection)message.get(HTTP_CONNECTION);
         String ct = (String) message.get(Message.CONTENT_TYPE);
+        String enc = (String) message.get(Message.ENCODING);
+
         if (null != ct) {
+            if (enc != null && ct.indexOf("charset=") == -1) {
+                ct = ct + "; charset=" + enc;
+            }
             connection.setRequestProperty(HttpHeaderHelper.CONTENT_TYPE, ct);
+        } else if (enc != null) {
+            connection.setRequestProperty(HttpHeaderHelper.CONTENT_TYPE, "text/xml; charset="
+ enc);
         } else {
             connection.setRequestProperty(HttpHeaderHelper.CONTENT_TYPE, "text/xml");
         }



Mime
View raw message