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 d6415a34873..28a8c69dc9e 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 @@ -172,7 +172,6 @@ public class WebSocketServerFactory extends ContainerLifeCycle implements WebSoc ServletUpgradeResponse sockresp = new ServletUpgradeResponse(response); Object websocketPojo = creator.createWebSocket(sockreq, sockresp); - websocketPojo = getObjectFactory().decorate(websocketPojo); // Handle response forbidden (and similar paths) if (sockresp.isCommitted()) @@ -187,6 +186,9 @@ public class WebSocketServerFactory extends ContainerLifeCycle implements WebSoc return false; } + // Allow Decorators to do their thing + websocketPojo = getObjectFactory().decorate(websocketPojo); + // Get the original HTTPConnection HttpConnection connection = (HttpConnection)request.getAttribute("org.eclipse.jetty.server.HttpConnection");