From 395e8f1c8b4dbaf129f4013eba360dc80f3ee8dc Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 19 Feb 2014 11:32:07 -0700 Subject: [PATCH] Adding examples of managing the websocket extensions --- .../jetty/websocket/server/browser/BrowserDebugTool.java | 7 ++++++- .../jetty/websocket/server/browser/BrowserSocket.java | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserDebugTool.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserDebugTool.java index 7ea355b8d6e..dd60c94fa8f 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserDebugTool.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserDebugTool.java @@ -83,8 +83,9 @@ public class BrowserDebugTool implements WebSocketCreator String ua = req.getHeader("User-Agent"); String rexts = req.getHeader("Sec-WebSocket-Extensions"); + LOG.debug("User-Agent: {}", ua); - LOG.debug("Sec-WebSocket-Extensions: {}", rexts); + LOG.debug("Sec-WebSocket-Extensions (Request) : {}", rexts); return new BrowserSocket(ua,rexts); } @@ -113,6 +114,10 @@ public class BrowserDebugTool implements WebSocketCreator { LOG.debug("Configuring WebSocketServerFactory ..."); + // factory.getExtensionFactory().unregister("deflate-frame"); + // factory.getExtensionFactory().unregister("permessage-deflate"); + // factory.getExtensionFactory().unregister("x-webkit-deflate-frame"); + // Setup the desired Socket to use for all incoming upgrade requests factory.setCreator(BrowserDebugTool.this); diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserSocket.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserSocket.java index b232b0f2d8d..83d3bcebc51 100644 --- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserSocket.java +++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/browser/BrowserSocket.java @@ -135,8 +135,10 @@ public class BrowserSocket } else { - writeMessage("Client Sec-WebSocket-Extensions: " + this.requestedExtensions); + writeMessage("Client requested Sec-WebSocket-Extensions: " + this.requestedExtensions); + writeMessage("Negotiated Sec-WebSocket-Extensions: " + session.getUpgradeResponse().getHeader("Sec-WebSocket-Extensions")); } + break; } case "many": @@ -225,7 +227,7 @@ public class BrowserSocket } // Async write - session.getRemote().sendString(message, null); + session.getRemote().sendString(message,null); } private void writeMessage(String format, Object... args)