cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1518568 - in /cxf/branches/2.6.x-fixes: ./ rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/jsonp/AbstractJsonpOutInterceptor.java
Date Thu, 29 Aug 2013 10:07:23 GMT
Author: sergeyb
Date: Thu Aug 29 10:07:22 2013
New Revision: 1518568

URL: http://svn.apache.org/r1518568
Log:
Merged revisions 1518561 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

................
  r1518561 | sergeyb | 2013-08-29 10:58:57 +0100 (Thu, 29 Aug 2013) | 9 lines
  
  Merged revisions 1518556 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1518556 | sergeyb | 2013-08-29 10:56:15 +0100 (Thu, 29 Aug 2013) | 1 line
    
    [CXF-5240] Fixing JSONP out interceptor to check message OutputStream first, thanks to
Vadim Beilin
  ........
................

Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/jsonp/AbstractJsonpOutInterceptor.java

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/branches/2.7.x-fixes:r1518561
  Merged /cxf/trunk:r1518556

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.6.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/jsonp/AbstractJsonpOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/jsonp/AbstractJsonpOutInterceptor.java?rev=1518568&r1=1518567&r2=1518568&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/jsonp/AbstractJsonpOutInterceptor.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/jsonp/AbstractJsonpOutInterceptor.java
Thu Aug 29 10:07:22 2013
@@ -20,6 +20,7 @@
 package org.apache.cxf.jaxrs.provider.jsonp;
 
 import java.io.IOException;
+import java.io.OutputStream;
 
 import javax.servlet.http.HttpServletResponse;
 
@@ -40,12 +41,20 @@ public abstract class AbstractJsonpOutIn
     }
     
     protected void writeValue(Message message, String value) throws Fault {
-        HttpServletResponse response = (HttpServletResponse) message.get("HTTP.RESPONSE");
         try {
-            response.getOutputStream().write(value.getBytes("UTF-8"));
+            getOutputStream(message).write(value.getBytes("UTF-8"));
         } catch (IOException e) {
             throw new Fault(e);
         }
     }
+    
+    private OutputStream getOutputStream(Message message) throws IOException {
+        OutputStream os = message.getContent(OutputStream.class);
+        if (os == null) {
+            HttpServletResponse response = (HttpServletResponse) message.get("HTTP.RESPONSE");
+            os = response.getOutputStream();
+        }
+        return os;
+    }
 
 }



Mime
View raw message