You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2015/11/13 18:20:57 UTC

cxf git commit: Fix checkstyle

Repository: cxf
Updated Branches:
  refs/heads/master 92b8fbba1 -> 16feba3f0


Fix checkstyle


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/16feba3f
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/16feba3f
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/16feba3f

Branch: refs/heads/master
Commit: 16feba3f058d19458e4da4da0bf8dc65fe4bade0
Parents: 92b8fbb
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Nov 13 12:20:34 2015 -0500
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Nov 13 12:20:50 2015 -0500

----------------------------------------------------------------------
 .../atmosphere/DefaultProtocolInterceptor.java  | 93 +++++++++++---------
 1 file changed, 52 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/16feba3f/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/DefaultProtocolInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/DefaultProtocolInterceptor.java b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/DefaultProtocolInterceptor.java
index 54431ce..3dde4b5 100644
--- a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/DefaultProtocolInterceptor.java
+++ b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/DefaultProtocolInterceptor.java
@@ -298,49 +298,60 @@ public class DefaultProtocolInterceptor extends AtmosphereInterceptorAdapter {
         @Override
         public ServletOutputStream getOutputStream() throws IOException {
             if (sout == null) {
-                sout = new ServletOutputStream() {
-                    CachedOutputStream out = new CachedOutputStream();
-                    OutputStream getOut() {
-                        if (out == null) {
-                            out = new CachedOutputStream();
-                        }
-                        return out;
-                    }                
-                    void send(boolean complete) throws IOException {
-                        if (out == null) {
-                            return;
-                        }
-                        if (response.getStatus() >= 400) {
-                            int i = response.getStatus();
-                            response.setStatus(200);
-                            response.addIntHeader(WebSocketUtils.SC_KEY, i);
-                        }
-                        out.flush();
-                        out.lockOutputStream();
-                        out.writeCacheTo(delegate);
-                        delegate.flush();
-                        out.close();
-                        out = null;
-                    }
-                    public void write(int i) throws IOException {
-                        getOut().write(i);
-                    }
-                    public void close() throws IOException {
-                        send(true);
-                        delegate.close();
-                    }
-                    public void flush() throws IOException {
-                        send(false);
-                    }
-                    public void write(byte[] b, int off, int len) throws IOException {
-                        getOut().write(b, off, len);
-                    }
-                    public void write(byte[] b) throws IOException {
-                        getOut().write(b);
-                    }
-                };
+                sout = new BufferedServletOutputStream();
             }
             return sout;
         }
+        
+        private final class BufferedServletOutputStream extends ServletOutputStream {
+            CachedOutputStream out = new CachedOutputStream();
+
+            OutputStream getOut() {
+                if (out == null) {
+                    out = new CachedOutputStream();
+                }
+                return out;
+            }
+
+            void send(boolean complete) throws IOException {
+                if (out == null) {
+                    return;
+                }
+                if (response.getStatus() >= 400) {
+                    int i = response.getStatus();
+                    response.setStatus(200);
+                    response.addIntHeader(WebSocketUtils.SC_KEY, i);
+                }
+                out.flush();
+                out.lockOutputStream();
+                out.writeCacheTo(delegate);
+                delegate.flush();
+                out.close();
+                out = null;
+            }
+
+            public void write(int i) throws IOException {
+                getOut().write(i);
+            }
+
+            public void close() throws IOException {
+                send(true);
+                delegate.close();
+            }
+
+            public void flush() throws IOException {
+                send(false);
+            }
+
+            public void write(byte[] b, int off, int len) throws IOException {
+                getOut().write(b, off, len);
+            }
+
+            public void write(byte[] b) throws IOException {
+                getOut().write(b);
+            }
+        }
+
+        
     }
 }