tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r578945 - /incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListenerServlet.java
Date Mon, 24 Sep 2007 20:16:45 GMT
Author: rfeng
Date: Mon Sep 24 13:16:41 2007
New Revision: 578945

URL: http://svn.apache.org/viewvc?rev=578945&view=rev
Log:
Merge the fix from 1.0-branch

Modified:
    incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListenerServlet.java

Modified: incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListenerServlet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListenerServlet.java?rev=578945&r1=578944&r2=578945&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListenerServlet.java
(original)
+++ incubator/tuscany/java/sca/modules/binding-feed/src/main/java/org/apache/tuscany/sca/binding/feed/provider/FeedBindingListenerServlet.java
Mon Sep 24 13:16:41 2007
@@ -20,7 +20,9 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
-import java.io.PrintWriter;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
 import java.util.StringTokenizer;
 import java.util.logging.Logger;
 
@@ -156,8 +158,10 @@
                 workspace.addContent(collection);
 
                 XMLOutputter outputter = new XMLOutputter();
-                outputter.setFormat(Format.getPrettyFormat());
-                outputter.output(document, response.getWriter());
+                Format format = Format.getPrettyFormat();
+                format.setEncoding("UTF-8");
+                outputter.setFormat(format);
+                outputter.output(document, getWriter(response));
 
             } else if (path == null || path.length() == 0 || path.equals("/")) {
 
@@ -177,8 +181,7 @@
                     feed.setFeedType(requestFeedType);
                     WireFeedOutput feedOutput = new WireFeedOutput();
                     try {
-                        OutputStream output = response.getOutputStream();
-                        feedOutput.output(feed, new PrintWriter(output));
+                        feedOutput.output(feed, getWriter(response));
                     } catch (FeedException e) {
                         throw new ServletException(e);
                     }
@@ -203,7 +206,7 @@
                 if (entry != null) {
                     response.setContentType("application/atom+xml; charset=utf-8");
                     try {
-                        AtomEntryUtil.writeEntry(entry, feedType, response.getWriter());
+                        AtomEntryUtil.writeEntry(entry, feedType, getWriter(response));
                     } catch (FeedException e) {
                         throw new ServletException(e);
                     }
@@ -238,8 +241,7 @@
                     syndFeed.setFeedType(requestFeedType);
                     SyndFeedOutput syndOutput = new SyndFeedOutput();
                     try {
-                        OutputStream output = response.getOutputStream();
-                        syndOutput.output(syndFeed, new PrintWriter(output));
+                        syndOutput.output(syndFeed, getWriter(response));
                     } catch (FeedException e) {
                         throw new ServletException(e);
                     }
@@ -328,7 +330,7 @@
                 response.setStatus(HttpServletResponse.SC_CREATED);
                 response.setContentType("application/atom+xml; charset=utf-8");
                 try {
-                    AtomEntryUtil.writeEntry(createdEntry, feedType, response.getWriter());
+                    AtomEntryUtil.writeEntry(createdEntry, feedType, getWriter(response));
                 } catch (FeedException e) {
                     throw new ServletException(e);
                 }
@@ -342,6 +344,11 @@
         }
     }
 
+    private Writer getWriter(HttpServletResponse response) throws UnsupportedEncodingException,
IOException {
+        Writer writer = new OutputStreamWriter(response.getOutputStream(), "UTF-8");
+        return writer;
+    }
+
     @Override
     protected void doPut(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
 
@@ -417,7 +424,7 @@
                 // Write the updated Atom entry
                 response.setContentType("application/atom+xml; charset=utf-8");
                 try {
-                    AtomEntryUtil.writeEntry(updatedEntry, feedType, response.getWriter());
+                    AtomEntryUtil.writeEntry(updatedEntry, feedType, getWriter(response));
                 } catch (FeedException e) {
                     throw new ServletException(e);
                 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message