From 5bf71f5125d0d6b797f5cbfe17d35b64e3f65067 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 16 Jul 2012 09:32:25 -0700 Subject: [PATCH] Support reponse forbidden better --- .../jetty/websocket/io/WebSocketAsyncConnection.java | 3 +++ .../jetty/websocket/server/WebSocketServerFactory.java | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/io/WebSocketAsyncConnection.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/io/WebSocketAsyncConnection.java index f455a6576f8..ee664fb3817 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/io/WebSocketAsyncConnection.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/io/WebSocketAsyncConnection.java @@ -262,6 +262,9 @@ public class WebSocketAsyncConnection extends AbstractAsyncConnection implements { LOG.debug("onOpen()"); super.onOpen(); + // TODO: websocket.setConnection(this); + // TODO: websocket.onConnect(); + fillInterested(); } diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java index 97bcd88c1a5..15d233dc908 100644 --- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java +++ b/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/WebSocketServerFactory.java @@ -119,7 +119,12 @@ public class WebSocketServerFactory extends AbstractLifeCycle implements WebSock WebSocketCreator creator = getCreator(); Object websocketPojo = creator.createWebSocket(sockreq,sockresp); - // TODO: Handle forbidden? + + // Handle response forbidden (and similar paths) + if (sockresp.isCommitted()) + { + return false; + } if (websocketPojo == null) { @@ -128,8 +133,6 @@ public class WebSocketServerFactory extends AbstractLifeCycle implements WebSock return false; } - // TODO: discover type, create proxy - // Send the upgrade WebSocketPolicy objPolicy = this.basePolicy.clonePolicy(); WebSocketEventDriver websocket = new WebSocketEventDriver(websocketPojo,methodsCache,objPolicy,bufferPool);