From c1ce7780a65d402b9f961eb481090564d761c456 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 5 Nov 2012 12:01:42 -0700 Subject: [PATCH] Updating rest for websocket-api --- jetty-websocket/javax-websocket-api/pom.xml | 66 ------ jetty-websocket/pom.xml | 1 - jetty-websocket/websocket-common/pom.xml | 124 ++++++----- .../{core/protocol => common}/AcceptHash.java | 2 +- .../{core/protocol => common}/CloseInfo.java | 29 +-- .../protocol => common}/ConnectionState.java | 2 +- .../{core/protocol => common}/Generator.java | 14 +- .../api => common}/LogicalConnection.java | 8 +- .../{core/protocol => common}/OpCode.java | 2 +- .../{core/protocol => common}/Parser.java | 28 +-- .../RequestedExtensionConfig.java} | 18 +- .../protocol => common}/WebSocketFrame.java | 110 +++++---- .../extensions/AbstractExtension.java} | 123 +---------- .../extensions/FrameHandlerAdapter.java | 58 +++++ .../WebSocketExtensionRegistry.java | 83 +++++++ .../compress/CompressionMethod.java | 2 +- .../compress/DeflateCompressionMethod.java | 4 +- .../PerMessageCompressionExtension.java | 198 +++++++++++++++++ .../compress/WebkitDeflateFrameExtension.java | 188 ++++++++++++++++ .../fragment/FragmentExtension.java | 117 ++++++++++ .../identity/IdentityExtension.java | 21 +- .../identity/IdentityFrameHandler.java} | 21 +- .../extensions/mux/AbstractMuxExtension.java | 12 +- .../extensions/mux/MuxChannel.java | 38 ++-- .../extensions/mux/MuxControlBlock.java | 2 +- .../extensions/mux/MuxException.java | 4 +- .../extensions/mux/MuxGenerator.java | 16 +- .../extensions/mux/MuxOp.java | 2 +- .../extensions/mux/MuxParser.java | 16 +- .../mux/MuxPhysicalConnectionException.java | 4 +- .../extensions/mux/MuxRequest.java | 12 +- .../extensions/mux/MuxResponse.java | 12 +- .../extensions/mux/MuxedFrame.java | 6 +- .../extensions/mux/Muxer.java | 34 +-- .../extensions/mux/add/MuxAddClient.java | 6 +- .../extensions/mux/add/MuxAddServer.java | 14 +- .../mux/op/MuxAddChannelRequest.java | 6 +- .../mux/op/MuxAddChannelResponse.java | 6 +- .../extensions/mux/op/MuxDropChannel.java | 6 +- .../extensions/mux/op/MuxFlowControl.java | 6 +- .../extensions/mux/op/MuxNewChannelSlot.java | 6 +- .../io/AbstractWebSocketConnection.java | 49 ++--- .../io/ControlFrameBytes.java | 8 +- .../{core => common}/io/DataFrameBytes.java | 4 +- .../{core => common}/io/FrameBytes.java | 4 +- .../{core => common}/io/FrameQueue.java | 2 +- .../{core => common}/io/IncomingFrames.java | 6 +- .../io/InternalConnection.java | 8 +- .../{core => common}/io/OutgoingFrames.java | 10 +- .../{core => common}/io/WebSocketSession.java | 70 ++++-- .../io/event/AnnotatedEventDriver.java | 24 +- .../io/event/EventDriver.java | 64 +++--- .../io/event/EventDriverFactory.java | 22 +- .../io/event/EventMethod.java | 6 +- .../io/event/EventMethods.java | 2 +- .../io/event/InvalidSignatureException.java | 4 +- .../io/event/ListenerEventDriver.java | 20 +- .../{core => common}/io/event/ParamList.java | 2 +- .../io/message/MessageAppender.java | 2 +- .../io/message/MessageInputStream.java | 4 +- .../io/message/MessageReader.java | 4 +- .../io/message/SimpleBinaryMessage.java | 4 +- .../io/message/SimpleTextMessage.java | 4 +- .../io/payload/CloseReasonValidator.java | 4 +- .../io/payload/DeMaskProcessor.java | 4 +- .../io/payload/NoOpValidator.java | 4 +- .../io/payload/PayloadProcessor.java | 6 +- .../io/payload/UTF8Validator.java | 6 +- .../core/annotations/OnWebSocketClose.java | 46 ---- .../core/annotations/OnWebSocketConnect.java | 45 ---- .../core/annotations/OnWebSocketFrame.java | 49 ----- .../core/annotations/OnWebSocketMessage.java | 61 ----- .../websocket/core/annotations/WebSocket.java | 43 ---- .../core/api/BadPayloadException.java | 46 ---- .../websocket/core/api/CloseException.java | 49 ----- .../core/api/InvalidWebSocketException.java | 45 ---- .../core/api/MessageTooLargeException.java | 43 ---- .../core/api/PolicyViolationException.java | 43 ---- .../websocket/core/api/ProtocolException.java | 41 ---- .../jetty/websocket/core/api/StatusCode.java | 141 ------------ .../websocket/core/api/SuspendToken.java | 30 --- .../websocket/core/api/UpgradeException.java | 46 ---- .../websocket/core/api/UpgradeRequest.java | 59 ----- .../websocket/core/api/UpgradeResponse.java | 99 --------- .../websocket/core/api/WebSocketAdapter.java | 83 ------- .../websocket/core/api/WebSocketBehavior.java | 31 --- .../core/api/WebSocketConnection.java | 75 ------- .../core/api/WebSocketException.java | 46 ---- .../websocket/core/api/WebSocketListener.java | 78 ------- .../websocket/core/api/WebSocketPolicy.java | 208 ------------------ .../api/io/WebSocketBlockingConnection.java | 122 ---------- .../core/api/io/WebSocketOutputStream.java | 50 ----- .../core/api/io/WebSocketWriter.java | 66 ------ .../WebSocketExtensionRegistry.java | 126 ----------- .../PerMessageCompressionExtension.java | 160 -------------- .../compress/WebkitDeflateFrameExtension.java | 157 ------------- .../fragment/FragmentExtension.java | 98 --------- .../jetty/websocket/core/io/FramePipes.java | 90 -------- .../jetty/websocket/core/protocol/Frame.java | 47 ---- .../core/GeneratorParserRoundtripTest.java | 10 +- .../websocket/core/ab/TestABCase1_1.java | 12 +- .../websocket/core/ab/TestABCase1_2.java | 12 +- .../jetty/websocket/core/ab/TestABCase2.java | 16 +- .../jetty/websocket/core/ab/TestABCase3.java | 8 +- .../jetty/websocket/core/ab/TestABCase4.java | 8 +- .../websocket/core/ab/TestABCase7_3.java | 16 +- .../annotations/BadBinarySignatureSocket.java | 6 +- .../annotations/BadDuplicateBinarySocket.java | 4 +- .../annotations/BadDuplicateFrameSocket.java | 6 +- .../annotations/BadTextSignatureSocket.java | 6 +- .../core/annotations/FrameSocket.java | 6 +- .../core/annotations/MyEchoBinarySocket.java | 4 +- .../core/annotations/MyEchoSocket.java | 12 +- .../annotations/MyStatelessEchoSocket.java | 6 +- .../core/annotations/NoopSocket.java | 2 +- .../core/annotations/NotASocket.java | 4 +- .../examples/AdapterConnectCloseSocket.java | 4 +- .../examples/AnnotatedBinaryArraySocket.java | 10 +- .../examples/AnnotatedBinaryStreamSocket.java | 10 +- .../core/examples/AnnotatedFramesSocket.java | 12 +- .../examples/AnnotatedStreamingSocket.java | 14 +- .../core/examples/AnnotatedTextSocket.java | 10 +- .../examples/AnnotatedTextStreamSocket.java | 10 +- .../core/examples/ListenerBasicSocket.java | 6 +- .../core/examples/echo/AdapterEchoSocket.java | 2 +- .../examples/echo/AnnotatedEchoSocket.java | 6 +- .../examples/echo/ListenerEchoSocket.java | 6 +- .../extensions/FragmentExtensionTest.java | 11 +- .../extensions/IdentityExtensionTest.java | 11 +- .../DeflateCompressionMethodTest.java | 2 + .../PerMessageCompressionExtensionTest.java | 10 +- .../WebkitDeflateFrameExtensionTest.java | 15 +- .../core/extensions/mux/MuxDecoder.java | 5 +- .../core/extensions/mux/MuxEncoder.java | 10 +- .../core/extensions/mux/MuxEventCapture.java | 16 +- .../mux/MuxGeneratorWrite139SizeTest.java | 1 + .../mux/MuxGeneratorWriteChannelIdTest.java | 1 + .../core/extensions/mux/MuxParserRFCTest.java | 16 +- .../MuxParserRead139Size_BadEncodingTest.java | 2 + .../mux/MuxParserRead139Size_GoodTest.java | 1 + ...uxParserReadChannelId_BadEncodingTest.java | 2 + .../mux/MuxParserReadChannelId_GoodTest.java | 1 + .../extensions/mux/add/DummyMuxAddClient.java | 5 +- .../extensions/mux/add/DummyMuxAddServer.java | 21 +- .../mux/add/MuxerAddClientTest.java | 12 +- .../mux/add/MuxerAddServerTest.java | 14 +- .../core/io/LocalWebSocketConnection.java | 15 +- .../core/io/LocalWebSocketSession.java | 5 +- .../core/io/event/EventDriverFactoryTest.java | 13 +- .../core/io/event/EventDriverTest.java | 12 +- .../core/io/payload/DeMaskProcessorTest.java | 4 +- .../core/io/payload/UTF8ValidatorTest.java | 4 +- .../core/protocol/AcceptHashTest.java | 2 +- .../core/protocol/ClosePayloadParserTest.java | 12 +- .../core/protocol/GeneratorTest.java | 14 +- .../core/protocol/IncomingFramesCapture.java | 8 +- .../core/protocol/OutgoingFramesCapture.java | 6 +- .../protocol/OutgoingNetworkBytesCapture.java | 4 +- .../websocket/core/protocol/ParserTest.java | 12 +- .../core/protocol/PingPayloadParserTest.java | 10 +- .../RFC6455ExamplesGeneratorTest.java | 6 +- .../protocol/RFC6455ExamplesParserTest.java | 10 +- .../core/protocol/TextPayloadParserTest.java | 14 +- .../core/protocol/UnitGenerator.java | 6 +- .../websocket/core/protocol/UnitParser.java | 4 +- .../core/protocol/WebSocketFrameTest.java | 12 +- 166 files changed, 1471 insertions(+), 3183 deletions(-) delete mode 100644 jetty-websocket/javax-websocket-api/pom.xml rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core/protocol => common}/AcceptHash.java (97%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core/protocol => common}/CloseInfo.java (93%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core/protocol => common}/ConnectionState.java (95%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core/protocol => common}/Generator.java (97%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core/api => common}/LogicalConnection.java (93%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core/protocol => common}/OpCode.java (98%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core/protocol => common}/Parser.java (95%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core/protocol/ExtensionConfig.java => common/RequestedExtensionConfig.java} (86%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core/protocol => common}/WebSocketFrame.java (90%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core/api/Extension.java => common/extensions/AbstractExtension.java} (53%) create mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/FrameHandlerAdapter.java create mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/WebSocketExtensionRegistry.java rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/compress/CompressionMethod.java (94%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/compress/DeflateCompressionMethod.java (98%) create mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageCompressionExtension.java create mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/WebkitDeflateFrameExtension.java create mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/fragment/FragmentExtension.java rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/identity/IdentityExtension.java (71%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core/api/ExtensionRegistry.java => common/extensions/identity/IdentityFrameHandler.java} (66%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/AbstractMuxExtension.java (83%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/MuxChannel.java (87%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/MuxControlBlock.java (93%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/MuxException.java (90%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/MuxGenerator.java (94%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/MuxOp.java (94%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/MuxParser.java (95%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/MuxPhysicalConnectionException.java (91%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/MuxRequest.java (92%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/MuxResponse.java (87%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/MuxedFrame.java (91%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/Muxer.java (91%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/add/MuxAddClient.java (82%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/add/MuxAddServer.java (78%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/op/MuxAddChannelRequest.java (92%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/op/MuxAddChannelResponse.java (93%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/op/MuxDropChannel.java (95%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/op/MuxFlowControl.java (88%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/extensions/mux/op/MuxNewChannelSlot.java (89%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/AbstractWebSocketConnection.java (89%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/ControlFrameBytes.java (90%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/DataFrameBytes.java (95%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/FrameBytes.java (96%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/FrameQueue.java (95%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/IncomingFrames.java (84%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/InternalConnection.java (79%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/OutgoingFrames.java (74%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/WebSocketSession.java (79%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/event/AnnotatedEventDriver.java (86%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/event/EventDriver.java (86%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/event/EventDriverFactory.java (94%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/event/EventMethod.java (96%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/event/EventMethods.java (98%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/event/InvalidSignatureException.java (95%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/event/ListenerEventDriver.java (82%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/event/ParamList.java (95%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/message/MessageAppender.java (96%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/message/MessageInputStream.java (96%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/message/MessageReader.java (95%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/message/SimpleBinaryMessage.java (94%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/message/SimpleTextMessage.java (94%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/payload/CloseReasonValidator.java (92%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/payload/DeMaskProcessor.java (93%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/payload/NoOpValidator.java (91%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/payload/PayloadProcessor.java (87%) rename jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/{core => common}/io/payload/UTF8Validator.java (93%) delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketClose.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketConnect.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketFrame.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketMessage.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/WebSocket.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/BadPayloadException.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/CloseException.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/InvalidWebSocketException.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/MessageTooLargeException.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/PolicyViolationException.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/ProtocolException.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/StatusCode.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/SuspendToken.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/UpgradeException.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/UpgradeRequest.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/UpgradeResponse.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketAdapter.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketBehavior.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketConnection.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketException.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketListener.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketPolicy.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/io/WebSocketBlockingConnection.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/io/WebSocketOutputStream.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/io/WebSocketWriter.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/WebSocketExtensionRegistry.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/compress/PerMessageCompressionExtension.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/compress/WebkitDeflateFrameExtension.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/fragment/FragmentExtension.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/FramePipes.java delete mode 100644 jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/Frame.java diff --git a/jetty-websocket/javax-websocket-api/pom.xml b/jetty-websocket/javax-websocket-api/pom.xml deleted file mode 100644 index 5e967045fba..00000000000 --- a/jetty-websocket/javax-websocket-api/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - org.eclipse.jetty.websocket - websocket-parent - 9.0.0-SNAPSHOT - - - 4.0.0 - org.eclipse.jetty.drafts - javax-websocket-api - 0.0.006.EDR - Jetty :: JSR-356 JavaWebSocket API - - - javax.net.websocket - - - - - org.eclipse.jetty.toolchain - jetty-test-helper - test - - - - - - - maven-compiler-plugin - - 1.7 - 1.7 - false - - - - - org.apache.maven.plugins - maven-enforcer-plugin - 1.1 - - - ban-java-servlet-api - - enforce - - - - - - javax.servlet - servletapi - org.eclipse.jetty.orbit:javax.servlet - org.mortbay.jetty:servlet-api - jetty:servlet-api - - - - - - - - - - diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index 8db8c96288e..19e8ed0944b 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -13,7 +13,6 @@ pom - javax-websocket-api websocket-common websocket-api websocket-client diff --git a/jetty-websocket/websocket-common/pom.xml b/jetty-websocket/websocket-common/pom.xml index 04f406d5c2e..94c46bc492a 100644 --- a/jetty-websocket/websocket-common/pom.xml +++ b/jetty-websocket/websocket-common/pom.xml @@ -1,65 +1,71 @@ - - - org.eclipse.jetty.websocket - websocket-parent - 9.0.0-SNAPSHOT - + + + org.eclipse.jetty.websocket + websocket-parent + 9.0.0-SNAPSHOT + - 4.0.0 - websocket-common - Jetty :: Websocket :: Common + 4.0.0 + websocket-common + Jetty :: Websocket :: Common - - ${project.groupId}.common - + + ${project.groupId}.common + - - - org.eclipse.jetty - jetty-util - ${project.version} - - - org.eclipse.jetty - jetty-io - ${project.version} - - - org.eclipse.jetty.toolchain - jetty-test-helper - test - - + + + org.eclipse.jetty.websocket + websocket-api + ${project.version} + + + org.eclipse.jetty + jetty-util + ${project.version} + + + org.eclipse.jetty + jetty-io + ${project.version} + + + org.eclipse.jetty.toolchain + jetty-test-helper + test + + - - - - org.apache.maven.plugins - maven-enforcer-plugin - 1.1 - - - ban-java-servlet-api - - enforce - - - - - - javax.servlet - servletapi - org.eclipse.jetty.orbit:javax.servlet - org.mortbay.jetty:servlet-api - jetty:servlet-api - - - - - - - - - + + + + org.apache.maven.plugins + maven-enforcer-plugin + 1.1 + + + ban-java-servlet-api + + enforce + + + + + + javax.servlet + servletapi + org.eclipse.jetty.orbit:javax.servlet + org.mortbay.jetty:servlet-api + jetty:servlet-api + + + + + + + + + diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/AcceptHash.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/AcceptHash.java similarity index 97% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/AcceptHash.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/AcceptHash.java index 3ed9ac07a1b..9028b335f9c 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/AcceptHash.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/AcceptHash.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.protocol; +package org.eclipse.jetty.websocket.common; import java.io.UnsupportedEncodingException; import java.security.MessageDigest; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/CloseInfo.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/CloseInfo.java similarity index 93% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/CloseInfo.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/CloseInfo.java index cb2939f6c4f..41765469621 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/CloseInfo.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/CloseInfo.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.protocol; +package org.eclipse.jetty.websocket.common; import java.nio.ByteBuffer; @@ -26,9 +26,10 @@ import org.eclipse.jetty.util.Utf8Appendable.NotUtf8Exception; import org.eclipse.jetty.util.Utf8StringBuilder; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.BadPayloadException; -import org.eclipse.jetty.websocket.core.api.ProtocolException; -import org.eclipse.jetty.websocket.core.api.StatusCode; +import org.eclipse.jetty.websocket.api.BadPayloadException; +import org.eclipse.jetty.websocket.api.ProtocolException; +import org.eclipse.jetty.websocket.api.StatusCode; +import org.eclipse.jetty.websocket.api.extensions.Frame; public class CloseInfo { @@ -107,6 +108,16 @@ public class CloseInfo } } + public CloseInfo(Frame frame) + { + this(frame.getPayload(),false); + } + + public CloseInfo(Frame frame, boolean validate) + { + this(frame.getPayload(),validate); + } + public CloseInfo(int statusCode) { this(statusCode, null); @@ -118,16 +129,6 @@ public class CloseInfo this.reason = reason; } - public CloseInfo(WebSocketFrame frame) - { - this(frame.getPayload(),false); - } - - public CloseInfo(WebSocketFrame frame, boolean validate) - { - this(frame.getPayload(),validate); - } - public ByteBuffer asByteBuffer() { if ((statusCode == StatusCode.NO_CLOSE) || (statusCode == StatusCode.NO_CODE) || (statusCode == (-1))) diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/ConnectionState.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/ConnectionState.java similarity index 95% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/ConnectionState.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/ConnectionState.java index 477acd873b5..c723d827401 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/ConnectionState.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/ConnectionState.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.protocol; +package org.eclipse.jetty.websocket.common; /** * Connection states as outlined in RFC6455. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/Generator.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/Generator.java similarity index 97% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/Generator.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/Generator.java index ed10883fa40..64934fe9142 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/Generator.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/Generator.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.protocol; +package org.eclipse.jetty.websocket.common; import java.nio.ByteBuffer; import java.util.List; @@ -25,10 +25,10 @@ import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.Extension; -import org.eclipse.jetty.websocket.core.api.ProtocolException; -import org.eclipse.jetty.websocket.core.api.WebSocketBehavior; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.ProtocolException; +import org.eclipse.jetty.websocket.api.WebSocketBehavior; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.extensions.AbstractExtension; /** * Generating a frame in WebSocket land. @@ -166,7 +166,7 @@ public class Generator } - public void configureFromExtensions(List exts) + public void configureFromExtensions(List exts) { // default this.rsv1InUse = false; @@ -174,7 +174,7 @@ public class Generator this.rsv3InUse = false; // configure from list of extensions in use - for(Extension ext: exts) + for(AbstractExtension ext: exts) { if (ext.isRsv1User()) { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/LogicalConnection.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/LogicalConnection.java similarity index 93% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/LogicalConnection.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/LogicalConnection.java index 53fbe9e1c59..731aa448ed4 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/LogicalConnection.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/LogicalConnection.java @@ -16,13 +16,13 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.api; +package org.eclipse.jetty.websocket.common; import java.net.InetSocketAddress; -import org.eclipse.jetty.websocket.core.io.OutgoingFrames; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.ConnectionState; +import org.eclipse.jetty.websocket.api.StatusCode; +import org.eclipse.jetty.websocket.api.SuspendToken; +import org.eclipse.jetty.websocket.common.io.OutgoingFrames; public interface LogicalConnection extends OutgoingFrames { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/OpCode.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/OpCode.java similarity index 98% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/OpCode.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/OpCode.java index 0383ab9ddc1..1d01ae67068 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/OpCode.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/OpCode.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.protocol; +package org.eclipse.jetty.websocket.common; public final class OpCode { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/Parser.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/Parser.java similarity index 95% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/Parser.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/Parser.java index 9ccf994fd7b..a8a986e0ca9 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/Parser.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/Parser.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.protocol; +package org.eclipse.jetty.websocket.common; import java.nio.ByteBuffer; import java.util.List; @@ -24,17 +24,17 @@ import java.util.List; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.Extension; -import org.eclipse.jetty.websocket.core.api.MessageTooLargeException; -import org.eclipse.jetty.websocket.core.api.ProtocolException; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.io.IncomingFrames; -import org.eclipse.jetty.websocket.core.io.payload.CloseReasonValidator; -import org.eclipse.jetty.websocket.core.io.payload.DeMaskProcessor; -import org.eclipse.jetty.websocket.core.io.payload.NoOpValidator; -import org.eclipse.jetty.websocket.core.io.payload.PayloadProcessor; -import org.eclipse.jetty.websocket.core.io.payload.UTF8Validator; +import org.eclipse.jetty.websocket.api.MessageTooLargeException; +import org.eclipse.jetty.websocket.api.ProtocolException; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.extensions.AbstractExtension; +import org.eclipse.jetty.websocket.common.io.IncomingFrames; +import org.eclipse.jetty.websocket.common.io.payload.CloseReasonValidator; +import org.eclipse.jetty.websocket.common.io.payload.DeMaskProcessor; +import org.eclipse.jetty.websocket.common.io.payload.NoOpValidator; +import org.eclipse.jetty.websocket.common.io.payload.PayloadProcessor; +import org.eclipse.jetty.websocket.common.io.payload.UTF8Validator; /** * Parsing of a frames in WebSocket land. @@ -115,7 +115,7 @@ public class Parser } } - public void configureFromExtensions(List exts) + public void configureFromExtensions(List exts) { // default this.rsv1InUse = false; @@ -124,7 +124,7 @@ public class Parser this.isTextFrameValidated = true; // configure from list of extensions in use - for(Extension ext: exts) + for(AbstractExtension ext: exts) { if (ext.isRsv1User()) { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/ExtensionConfig.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/RequestedExtensionConfig.java similarity index 86% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/ExtensionConfig.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/RequestedExtensionConfig.java index 080204bc986..ce8e0f6be04 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/ExtensionConfig.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/RequestedExtensionConfig.java @@ -16,24 +16,25 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.protocol; +package org.eclipse.jetty.websocket.common; import java.util.HashMap; import java.util.Map; import java.util.Set; import org.eclipse.jetty.util.QuotedStringTokenizer; +import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig; /** * Proposed interface for API (not yet settled) */ -public class ExtensionConfig +public class RequestedExtensionConfig implements ExtensionConfig { public static ExtensionConfig parse(String parameterizedName) { QuotedStringTokenizer tok = new QuotedStringTokenizer(parameterizedName,";"); - ExtensionConfig ext = new ExtensionConfig(tok.nextToken().trim()); + RequestedExtensionConfig ext = new RequestedExtensionConfig(tok.nextToken().trim()); while (tok.hasMoreTokens()) { @@ -49,17 +50,19 @@ public class ExtensionConfig private final String name; private Map parameters; - public ExtensionConfig(String name) + public RequestedExtensionConfig(String name) { this.name = name; this.parameters = new HashMap<>(); } + @Override public String getName() { return name; } + @Override public int getParameter(String key, int defValue) { String val = parameters.get(key); @@ -69,6 +72,7 @@ public class ExtensionConfig return Integer.valueOf(val); } + @Override public String getParameter(String key, String defValue) { String val = parameters.get(key); @@ -78,6 +82,7 @@ public class ExtensionConfig return val; } + @Override public String getParameterizedName() { StringBuilder str = new StringBuilder(); @@ -89,6 +94,7 @@ public class ExtensionConfig return str.toString(); } + @Override public Set getParameterKeys() { return parameters.keySet(); @@ -98,17 +104,19 @@ public class ExtensionConfig * Initialize the parameters on this config from the other configuration. * @param other the other configuration. */ - public void init(ExtensionConfig other) + public void init(RequestedExtensionConfig other) { this.parameters.clear(); this.parameters.putAll(other.parameters); } + @Override public void setParameter(String key, int value) { parameters.put(key,Integer.toString(value)); } + @Override public void setParameter(String key, String value) { parameters.put(key,value); diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/WebSocketFrame.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketFrame.java similarity index 90% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/WebSocketFrame.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketFrame.java index e1f0051a1d1..ac1f9f6ff08 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/WebSocketFrame.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketFrame.java @@ -16,13 +16,14 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.protocol; +package org.eclipse.jetty.websocket.common; import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.websocket.core.api.ProtocolException; +import org.eclipse.jetty.websocket.api.ProtocolException; +import org.eclipse.jetty.websocket.api.extensions.Frame; /** * A Base Frame as seen in RFC 6455. Sec 5.2 @@ -100,6 +101,7 @@ public class WebSocketFrame implements Frame /** position of start of data within a fresh payload */ private int payloadStart = -1; + private Type type; private boolean continuation = false; private int continuationIndex = 0; @@ -120,6 +122,38 @@ public class WebSocketFrame implements Frame this.opcode = opcode; } + /** + * Copy constructor for the websocket frame. + * + * @param copy + * the websocket to copy. + */ + public WebSocketFrame(Frame frame) + { + if(frame instanceof WebSocketFrame) { + WebSocketFrame wsf = (WebSocketFrame)frame; + copy(wsf,wsf.data); + } else { + // Copy manually + fin = frame.isFin(); + rsv1 = frame.isRsv1(); + rsv2 = frame.isRsv2(); + rsv3 = frame.isRsv3(); + opcode = frame.getType().getOpCode(); + type = frame.getType(); + masked = frame.isMasked(); + mask = null; + byte maskCopy[] = frame.getMask(); + if (maskCopy != null) + { + mask = new byte[maskCopy.length]; + System.arraycopy(maskCopy,0,mask,0,mask.length); + } + + setPayload(frame.getPayload()); + } + } + /** * Copy constructor for the websocket frame. *

@@ -130,26 +164,7 @@ public class WebSocketFrame implements Frame */ public WebSocketFrame(WebSocketFrame copy) { - fin = copy.fin; - rsv1 = copy.rsv2; - rsv2 = copy.rsv2; - rsv3 = copy.rsv3; - opcode = copy.opcode; - masked = copy.masked; - mask = null; - if (copy.mask != null) - { - mask = new byte[copy.mask.length]; - System.arraycopy(copy.mask,0,mask,0,mask.length); - } - payloadLength = copy.payloadLength; - payloadStart = copy.payloadStart; - if (copy.data != null) // deal with empty payloads - { - data = copy.data.slice(); - } - continuationIndex = copy.continuationIndex; - continuation = copy.continuation; + copy(copy,copy.data); } /** @@ -164,21 +179,7 @@ public class WebSocketFrame implements Frame */ public WebSocketFrame(WebSocketFrame copy, ByteBuffer altPayload) { - fin = copy.fin; - rsv1 = copy.rsv2; - rsv2 = copy.rsv2; - rsv3 = copy.rsv3; - opcode = copy.opcode; - masked = copy.masked; - mask = null; - if (copy.mask != null) - { - mask = new byte[copy.mask.length]; - System.arraycopy(copy.mask,0,mask,0,mask.length); - } - continuationIndex = copy.continuationIndex; - continuation = copy.continuation; - setPayload(altPayload); + copy(copy,altPayload); } public void assertValid() @@ -218,6 +219,27 @@ public class WebSocketFrame implements Frame } } + private final void copy(WebSocketFrame copy, ByteBuffer payload) + { + fin = copy.fin; + rsv1 = copy.rsv1; + rsv2 = copy.rsv2; + rsv3 = copy.rsv3; + opcode = copy.opcode; + type = copy.type; + masked = copy.masked; + mask = null; + if (copy.mask != null) + { + mask = new byte[copy.mask.length]; + System.arraycopy(copy.mask,0,mask,0,mask.length); + } + continuationIndex = copy.continuationIndex; + continuation = copy.continuation; + + setPayload(payload); + } + /** * The number of fragments this frame consists of. *

@@ -242,7 +264,6 @@ public class WebSocketFrame implements Frame return mask; } - @Override public final byte getOpCode() { return opcode; @@ -297,6 +318,12 @@ public class WebSocketFrame implements Frame return payloadStart; } + @Override + public Type getType() + { + return type; + } + public boolean hasPayload() { return ((data != null) && (payloadLength > 0)); @@ -323,6 +350,12 @@ public class WebSocketFrame implements Frame return fin; } + @Override + public boolean isLast() + { + return fin; + } + public boolean isLastFrame() { return fin; @@ -433,6 +466,7 @@ public class WebSocketFrame implements Frame public WebSocketFrame setOpCode(byte op) { this.opcode = op; + this.type = Frame.Type.from(op); return this; } diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/Extension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/AbstractExtension.java similarity index 53% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/Extension.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/AbstractExtension.java index 3d54f72943d..8f3a3f042ea 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/Extension.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/AbstractExtension.java @@ -16,28 +16,19 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.api; - -import java.io.IOException; +package org.eclipse.jetty.websocket.common.extensions; import org.eclipse.jetty.io.ByteBufferPool; -import org.eclipse.jetty.util.Callback; -import org.eclipse.jetty.util.FutureCallback; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.io.IncomingFrames; -import org.eclipse.jetty.websocket.core.io.OutgoingFrames; -import org.eclipse.jetty.websocket.core.protocol.ExtensionConfig; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.extensions.Extension; +import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig; -public abstract class Extension implements OutgoingFrames, IncomingFrames +public abstract class AbstractExtension implements Extension { - private Logger LOG = Log.getLogger(this.getClass()); private WebSocketPolicy policy; private ByteBufferPool bufferPool; private ExtensionConfig config; - private IncomingFrames nextIncomingFrames; - private OutgoingFrames nextOutgoingFrames; private WebSocketConnection connection; public ByteBufferPool getBufferPool() @@ -45,6 +36,7 @@ public abstract class Extension implements OutgoingFrames, IncomingFrames return bufferPool; } + @Override public ExtensionConfig getConfig() { return config; @@ -55,45 +47,17 @@ public abstract class Extension implements OutgoingFrames, IncomingFrames return connection; } + @Override public String getName() { return config.getName(); } - public IncomingFrames getNextIncomingFrames() - { - return nextIncomingFrames; - } - - public OutgoingFrames getNextOutgoingFrames() - { - return nextOutgoingFrames; - } - - public String getParameterizedName() - { - return config.getParameterizedName(); - } - public WebSocketPolicy getPolicy() { return policy; } - @Override - public void incoming(WebSocketException e) - { - // pass thru, un-modified - nextIncoming(e); - } - - @Override - public void incoming(WebSocketFrame frame) - { - // pass thru, un-modified - nextIncoming(frame); - } - /** * Used to indicate that the extension makes use of the RSV1 bit of the base websocket framing. *

@@ -146,67 +110,6 @@ public abstract class Extension implements OutgoingFrames, IncomingFrames return false; } - /** - * Convenience method for {@link #getNextIncomingFrames()#incoming(WebSocketException)} - * - * @param e - * the exception to pass to the next input/incoming - */ - public void nextIncoming(WebSocketException e) - { - if (LOG.isDebugEnabled()) - { - LOG.debug("nextIncoming({}) - {}",e,nextIncomingFrames); - } - nextIncomingFrames.incoming(e); - } - - /** - * Convenience method for {@link #getNextIncomingFrames()#incoming(WebSocketFrame)} - * - * @param frame - * the frame to send to the next input/incoming - */ - public void nextIncoming(WebSocketFrame frame) - { - if (LOG.isDebugEnabled()) - { - LOG.debug("nextIncoming({}) - {}",frame,nextIncomingFrames); - } - nextIncomingFrames.incoming(frame); - } - - /** - * Convenience method for {@link #getNextOutgoingFrames()#output(WebSocketFrame)} - * - * @param frame - * the frame to send to the next output - */ - public void nextOutput(C context, Callback callback, WebSocketFrame frame) throws IOException - { - if (LOG.isDebugEnabled()) - { - LOG.debug("nextOutput({}) - {}",frame,nextOutgoingFrames); - } - nextOutgoingFrames.output(context,callback,frame); - } - - public void nextOutputNoCallback(WebSocketFrame frame) throws IOException - { - if (LOG.isDebugEnabled()) - { - LOG.debug("nextOutput({}) - {}",frame,nextOutgoingFrames); - } - nextOutgoingFrames.output(null,new FutureCallback(),frame); - } - - @Override - public void output(C context, Callback callback, WebSocketFrame frame) throws IOException - { - // pass thru, un-modified - nextOutput(context,callback,frame); - } - public void setBufferPool(ByteBufferPool bufferPool) { this.bufferPool = bufferPool; @@ -222,16 +125,6 @@ public abstract class Extension implements OutgoingFrames, IncomingFrames this.connection = connection; } - public void setNextIncomingFrames(IncomingFrames nextIncomingFramesHandler) - { - this.nextIncomingFrames = nextIncomingFramesHandler; - } - - public void setNextOutgoingFrames(OutgoingFrames nextOutgoingFramesHandler) - { - this.nextOutgoingFrames = nextOutgoingFramesHandler; - } - public void setPolicy(WebSocketPolicy policy) { this.policy = policy; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/FrameHandlerAdapter.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/FrameHandlerAdapter.java new file mode 100644 index 00000000000..2a44271abbd --- /dev/null +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/FrameHandlerAdapter.java @@ -0,0 +1,58 @@ +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.common.extensions; + + +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.api.extensions.Frame; +import org.eclipse.jetty.websocket.api.extensions.FrameHandler; +import org.eclipse.jetty.websocket.api.extensions.FrameHandlerWrapper; + +public abstract class FrameHandlerAdapter implements FrameHandlerWrapper +{ + private Logger log; + private FrameHandler nextHandler; + + public FrameHandlerAdapter() + { + log = Log.getLogger(this.getClass()); + } + + @Override + public FrameHandler getNextHandler() + { + return nextHandler; + } + + protected void nextHandler(Frame frame) + { + if (log.isDebugEnabled()) + { + log.debug("nextHandler({}) -> {}",frame,nextHandler); + } + nextHandler.handleFrame(frame); + } + + @Override + public void setNextHandler(FrameHandler handler) + { + this.nextHandler = handler; + } +} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/WebSocketExtensionRegistry.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/WebSocketExtensionRegistry.java new file mode 100644 index 00000000000..7c1d144aec9 --- /dev/null +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/WebSocketExtensionRegistry.java @@ -0,0 +1,83 @@ +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.common.extensions; + +import org.eclipse.jetty.io.ByteBufferPool; +import org.eclipse.jetty.util.StringUtil; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.extensions.Extension; +import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig; +import org.eclipse.jetty.websocket.api.extensions.ExtensionRegistry; + +public class WebSocketExtensionRegistry extends ExtensionRegistry +{ + private WebSocketPolicy policy; + private ByteBufferPool bufferPool; + + public WebSocketExtensionRegistry(WebSocketPolicy policy, ByteBufferPool bufferPool) + { + this.policy = policy; + this.bufferPool = bufferPool; + + // FIXME this.registry.put("identity",IdentityExtension.class); + // FIXME this.registry.put("fragment",FragmentExtension.class); + // FIXME this.registry.put("x-webkit-deflate-frame",WebkitDeflateFrameExtension.class); + // FIXME this.registry.put("permessage-compress",PerMessageCompressionExtension.class); + } + + public Extension newInstance(ExtensionConfig config) + { + if (config == null) + { + return null; + } + + String name = config.getName(); + if (StringUtil.isBlank(name)) + { + return null; + } + + Extension registeredExt = getExtension(name); + if (registeredExt == null) + { + return null; + } + + Class extClass = registeredExt.getClass(); + + try + { + Extension ext = extClass.newInstance(); + if (ext instanceof AbstractExtension) + { + AbstractExtension aext = (AbstractExtension)ext; + aext.setConfig(config); + aext.setPolicy(policy); + aext.setBufferPool(bufferPool); + } + return ext; + } + catch (InstantiationException | IllegalAccessException e) + { + throw new WebSocketException("Cannot instantiate extension: " + extClass,e); + } + } +} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/compress/CompressionMethod.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressionMethod.java similarity index 94% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/compress/CompressionMethod.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressionMethod.java index 3b1840d75c9..85855e19ea8 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/compress/CompressionMethod.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/CompressionMethod.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.compress; +package org.eclipse.jetty.websocket.common.extensions.compress; import java.nio.ByteBuffer; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/compress/DeflateCompressionMethod.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateCompressionMethod.java similarity index 98% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/compress/DeflateCompressionMethod.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateCompressionMethod.java index d09c467645b..de8f1d96a32 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/compress/DeflateCompressionMethod.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/DeflateCompressionMethod.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.compress; +package org.eclipse.jetty.websocket.common.extensions.compress; import java.nio.ByteBuffer; import java.util.zip.DataFormatException; @@ -26,7 +26,7 @@ import java.util.zip.Inflater; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.BadPayloadException; +import org.eclipse.jetty.websocket.api.BadPayloadException; /** * Deflate Compression Method diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageCompressionExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageCompressionExtension.java new file mode 100644 index 00000000000..ccac84b0ce3 --- /dev/null +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/PerMessageCompressionExtension.java @@ -0,0 +1,198 @@ +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.common.extensions.compress; + +import java.nio.ByteBuffer; + +import org.eclipse.jetty.io.ByteBufferPool; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig; +import org.eclipse.jetty.websocket.api.extensions.Frame; +import org.eclipse.jetty.websocket.api.extensions.FrameHandler; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.AbstractExtension; +import org.eclipse.jetty.websocket.common.extensions.FrameHandlerAdapter; + +/** + * Per Message Compression extension for WebSocket. + *

+ * Attempts to follow draft-ietf-hybi-permessage-compression-01 + */ +public class PerMessageCompressionExtension extends AbstractExtension +{ + private static class CompressMessageHandler extends FrameHandlerAdapter + { + private final CompressionMethod method; + private final ByteBufferPool bufferPool; + + public CompressMessageHandler(CompressionMethod method, ByteBufferPool bufferPool) + { + this.method = method; + this.bufferPool = bufferPool; + } + + @Override + public void handleFrame(Frame frame) + { + if (frame instanceof Frame.Control) + { + // skip, cannot compress control frames. + nextHandler(frame); + return; + } + + ByteBuffer data = frame.getPayload(); + try + { + // deflate data + method.compress().input(data); + while (!method.compress().isDone()) + { + ByteBuffer buf = method.compress().process(); + WebSocketFrame out = new WebSocketFrame(frame).setPayload(buf); + out.setRsv1(true); + if (!method.compress().isDone()) + { + out.setFin(false); + nextHandler(out); + } + else + { + nextHandler(out); + } + } + + // reset only at end of message + if (frame.isFin()) + { + method.compress().end(); + } + } + finally + { + // free original data buffer + bufferPool.release(data); + } + } + } + + private static class DecompressMessageHandler extends FrameHandlerAdapter + { + private CompressionMethod method; + private final ByteBufferPool bufferPool; + + public DecompressMessageHandler(CompressionMethod method, ByteBufferPool bufferPool) + { + this.method = method; + this.bufferPool = bufferPool; + } + + @Override + public void handleFrame(Frame frame) + { + if ((frame instanceof Frame.Control) || !frame.isRsv1()) + { + // Cannot modify incoming control frames or ones with RSV1 set. + nextHandler(frame); + return; + } + + ByteBuffer data = frame.getPayload(); + try + { + method.decompress().input(data); + while (!method.decompress().isDone()) + { + ByteBuffer uncompressed = method.decompress().process(); + if (uncompressed == null) + { + continue; + } + WebSocketFrame out = new WebSocketFrame(frame).setPayload(uncompressed); + if (!method.decompress().isDone()) + { + out.setFin(false); + } + nextHandler(out); + } + + // reset only at the end of a message. + if (frame.isFin()) + { + method.decompress().end(); + } + } + finally + { + // release original buffer (no longer needed) + bufferPool.release(data); + } + } + } + + private static final Logger LOG = Log.getLogger(PerMessageCompressionExtension.class); + + private CompressionMethod method; + + @Override + public FrameHandler createIncomingFrameHandler() + { + return new DecompressMessageHandler(method,getBufferPool()); + } + + @Override + public FrameHandler createOutgoingFrameHandler() + { + return new CompressMessageHandler(method,getBufferPool()); + } + + /** + * Indicates use of RSV1 flag for indicating deflation is in use. + */ + @Override + public boolean isRsv1User() + { + return true; + } + + @Override + public boolean isTextDataDecoder() + { + // this extension is responsible for text data frames + return true; + } + + @Override + public void setConfig(ExtensionConfig config) + { + super.setConfig(config); + + String methodOptions = config.getParameter("method","deflate"); + LOG.debug("Method requested: {}",methodOptions); + + method = new DeflateCompressionMethod(); + } + + @Override + public String toString() + { + return String.format("%s[method=%s]",this.getClass().getSimpleName(),method); + } +} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/WebkitDeflateFrameExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/WebkitDeflateFrameExtension.java new file mode 100644 index 00000000000..9958b3b4fab --- /dev/null +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/compress/WebkitDeflateFrameExtension.java @@ -0,0 +1,188 @@ +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.common.extensions.compress; + +import java.nio.ByteBuffer; + +import org.eclipse.jetty.io.ByteBufferPool; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig; +import org.eclipse.jetty.websocket.api.extensions.Frame; +import org.eclipse.jetty.websocket.api.extensions.FrameHandler; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.AbstractExtension; +import org.eclipse.jetty.websocket.common.extensions.FrameHandlerAdapter; + +/** + * Implementation of the x-webkit-deflate-frame extension seen out + * in the wild. + */ +public class WebkitDeflateFrameExtension extends AbstractExtension +{ + private static class CompressFrameHandler extends FrameHandlerAdapter + { + private final CompressionMethod method; + private final ByteBufferPool bufferPool; + + public CompressFrameHandler(DeflateCompressionMethod method, ByteBufferPool bufferPool) + { + this.method = method; + this.bufferPool = bufferPool; + } + + @Override + public void handleFrame(Frame frame) + { + if (frame instanceof Frame.Control) + { + // skip, cannot compress control frames. + nextHandler(frame); + return; + } + + ByteBuffer data = frame.getPayload(); + try + { + // deflate data + method.compress().input(data); + while (!method.compress().isDone()) + { + ByteBuffer buf = method.compress().process(); + WebSocketFrame out = new WebSocketFrame(frame).setPayload(buf); + out.setRsv1(true); + if (!method.compress().isDone()) + { + out.setFin(false); + } + + nextHandler(out); + } + + // reset on every frame. + method.compress().end(); + } + finally + { + // free original data buffer + bufferPool.release(data); + } + } + } + + private static class DecompressFrameHandler extends FrameHandlerAdapter + { + private final CompressionMethod method; + private final ByteBufferPool bufferPool; + + public DecompressFrameHandler(DeflateCompressionMethod method, ByteBufferPool bufferPool) + { + this.method = method; + this.bufferPool = bufferPool; + + } + + @Override + public void handleFrame(Frame frame) + { + if ((frame instanceof Frame.Control) || !frame.isRsv1()) + { + // Cannot modify incoming control frames or ones with RSV1 set. + nextHandler(frame); + return; + } + + LOG.debug("Decompressing Frame: {}",frame); + + ByteBuffer data = frame.getPayload(); + try + { + method.decompress().input(data); + while (!method.decompress().isDone()) + { + ByteBuffer uncompressed = method.decompress().process(); + WebSocketFrame out = new WebSocketFrame(frame).setPayload(uncompressed); + if (!method.decompress().isDone()) + { + out.setFin(false); + } + nextHandler(out); + } + + // reset on every frame. + method.decompress().end(); + } + finally + { + // release original buffer (no longer needed) + bufferPool.release(data); + } + } + } + + private static final Logger LOG = Log.getLogger(WebkitDeflateFrameExtension.class); + + private DeflateCompressionMethod method; + + @Override + public FrameHandler createIncomingFrameHandler() + { + return new DecompressFrameHandler(method,getBufferPool()); + } + + @Override + public FrameHandler createOutgoingFrameHandler() + { + return new CompressFrameHandler(method,getBufferPool()); + } + + /** + * Indicates use of RSV1 flag for indicating deflation is in use. + *

+ * Also known as the "COMP" framing header bit + */ + @Override + public boolean isRsv1User() + { + return true; + } + + /** + * Indicate that this extensions is now responsible for TEXT Data Frame compliance to the WebSocket spec. + */ + @Override + public boolean isTextDataDecoder() + { + return true; + } + + @Override + public void setConfig(ExtensionConfig config) + { + super.setConfig(config); + + method = new DeflateCompressionMethod(); + } + + @Override + public String toString() + { + return this.getClass().getSimpleName() + "[]"; + } +} \ No newline at end of file diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/fragment/FragmentExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/fragment/FragmentExtension.java new file mode 100644 index 00000000000..a4aa44b711e --- /dev/null +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/fragment/FragmentExtension.java @@ -0,0 +1,117 @@ +// +// ======================================================================== +// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.common.extensions.fragment; + +import java.nio.ByteBuffer; + +import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig; +import org.eclipse.jetty.websocket.api.extensions.Frame; +import org.eclipse.jetty.websocket.api.extensions.FrameHandler; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.AbstractExtension; +import org.eclipse.jetty.websocket.common.extensions.FrameHandlerAdapter; + +public class FragmentExtension extends AbstractExtension +{ + /** + * Handler to break apart the frames into multiple smaller frames. + */ + private class FragmentHandler extends FrameHandlerAdapter + { + @Override + public void handleFrame(Frame frame) + { + if (frame instanceof Frame.Control) + { + // Cannot fragment Control Frames + nextHandler(frame); + return; + } + + int length = frame.getPayloadLength(); + + byte opcode = frame.getOpCode(); // original opcode + ByteBuffer payload = frame.getPayload().slice(); + int originalLimit = payload.limit(); + int currentPosition = payload.position(); + + if (maxLength <= 0) + { + // output original frame + nextHandler(frame); + return; + } + + boolean continuation = false; + + // break apart payload based on maxLength rules + while (length > maxLength) + { + WebSocketFrame frag = new WebSocketFrame(frame); + frag.setOpCode(opcode); + frag.setFin(false); // always false here + frag.setContinuation(continuation); + payload.position(currentPosition); + payload.limit(Math.min(payload.position() + maxLength,originalLimit)); + frag.setPayload(payload); + + nextHandler(frag); + + length -= maxLength; + opcode = OpCode.CONTINUATION; + continuation = true; + currentPosition = payload.limit(); + } + + // write remaining + WebSocketFrame frag = new WebSocketFrame(frame); + frag.setOpCode(opcode); + frag.setFin(frame.isFin()); // use original fin + frag.setContinuation(continuation); + payload.position(currentPosition); + payload.limit(originalLimit); + frag.setPayload(payload); + + nextHandler(frag); + } + } + + private int maxLength = -1; + + @Override + public FrameHandler createIncomingFrameHandler() + { + return new FragmentHandler(); + } + + @Override + public FrameHandler createOutgoingFrameHandler() + { + return new FragmentHandler(); + } + + @Override + public void setConfig(ExtensionConfig config) + { + super.setConfig(config); + + maxLength = config.getParameter("maxLength",maxLength); + } +} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/identity/IdentityExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/identity/IdentityExtension.java similarity index 71% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/identity/IdentityExtension.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/identity/IdentityExtension.java index 169b8c97f69..fad2a7a1d88 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/identity/IdentityExtension.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/identity/IdentityExtension.java @@ -16,16 +16,29 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.identity; +package org.eclipse.jetty.websocket.common.extensions.identity; import org.eclipse.jetty.util.QuotedStringTokenizer; -import org.eclipse.jetty.websocket.core.api.Extension; -import org.eclipse.jetty.websocket.core.protocol.ExtensionConfig; +import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig; +import org.eclipse.jetty.websocket.api.extensions.FrameHandler; +import org.eclipse.jetty.websocket.common.extensions.AbstractExtension; -public class IdentityExtension extends Extension +public class IdentityExtension extends AbstractExtension { private String id; + @Override + public FrameHandler createIncomingFrameHandler() + { + return new IdentityFrameHandler(); + } + + @Override + public FrameHandler createOutgoingFrameHandler() + { + return new IdentityFrameHandler(); + } + @Override public void setConfig(ExtensionConfig config) { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/ExtensionRegistry.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/identity/IdentityFrameHandler.java similarity index 66% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/ExtensionRegistry.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/identity/IdentityFrameHandler.java index c9d70449b1e..b6259296142 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/ExtensionRegistry.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/identity/IdentityFrameHandler.java @@ -16,18 +16,19 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.api; +package org.eclipse.jetty.websocket.common.extensions.identity; -import java.util.Iterator; +import org.eclipse.jetty.websocket.api.extensions.Frame; +import org.eclipse.jetty.websocket.common.extensions.FrameHandlerAdapter; -public interface ExtensionRegistry extends Iterable> +/** + * FrameHandler that just passes frames through with no modification. + */ +public class IdentityFrameHandler extends FrameHandlerAdapter { - public boolean isAvailable(String name); - @Override - public Iterator> iterator(); - - public void register(String name, Class extension); - - public void unregister(String name); + public void handleFrame(Frame frame) + { + nextHandler(frame); + } } diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/AbstractMuxExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/AbstractMuxExtension.java similarity index 83% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/AbstractMuxExtension.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/AbstractMuxExtension.java index bf567f530be..664b051f79f 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/AbstractMuxExtension.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/AbstractMuxExtension.java @@ -16,20 +16,20 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux; +package org.eclipse.jetty.websocket.common.extensions.mux; import org.eclipse.jetty.util.Callback; -import org.eclipse.jetty.websocket.core.api.Extension; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.AbstractExtension; /** * Multiplexing Extension for WebSockets. *

* Supporting draft-ietf-hybi-websocket-multiplexing-08 Specification. */ -public abstract class AbstractMuxExtension extends Extension +public abstract class AbstractMuxExtension extends AbstractExtension { private Muxer muxer; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxChannel.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxChannel.java similarity index 87% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxChannel.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxChannel.java index 33e06d40613..80fe83a91c7 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxChannel.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxChannel.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux; +package org.eclipse.jetty.websocket.common.extensions.mux; import java.io.IOException; import java.net.InetSocketAddress; @@ -30,19 +30,19 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.FutureCallback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.Extension; -import org.eclipse.jetty.websocket.core.api.StatusCode; -import org.eclipse.jetty.websocket.core.api.SuspendToken; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.io.IncomingFrames; -import org.eclipse.jetty.websocket.core.io.InternalConnection; -import org.eclipse.jetty.websocket.core.io.OutgoingFrames; -import org.eclipse.jetty.websocket.core.io.WebSocketSession; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.ConnectionState; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.StatusCode; +import org.eclipse.jetty.websocket.api.SuspendToken; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.ConnectionState; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.AbstractExtension; +import org.eclipse.jetty.websocket.common.io.IncomingFrames; +import org.eclipse.jetty.websocket.common.io.InternalConnection; +import org.eclipse.jetty.websocket.common.io.OutgoingFrames; +import org.eclipse.jetty.websocket.common.io.WebSocketSession; /** * MuxChannel, acts as WebSocketConnection for specific sub-channel. @@ -97,7 +97,7 @@ public class MuxChannel implements WebSocketConnection, InternalConnection, Inco } @Override - public void configureFromExtensions(List extensions) + public void configureFromExtensions(List extensions) { /* ignore */ } @@ -284,7 +284,7 @@ public class MuxChannel implements WebSocketConnection, InternalConnection, Inco return this; } - public void wireUpExtensions(List extensions) + public void wireUpExtensions(List extensions) { // Start with default routing. incoming = session; @@ -292,12 +292,12 @@ public class MuxChannel implements WebSocketConnection, InternalConnection, Inco if (extensions != null) { - Iterator extIter; + Iterator extIter; // Connect outgoings extIter = extensions.iterator(); while (extIter.hasNext()) { - Extension ext = extIter.next(); + AbstractExtension ext = extIter.next(); ext.setNextOutgoingFrames(outgoing); outgoing = ext; } @@ -307,7 +307,7 @@ public class MuxChannel implements WebSocketConnection, InternalConnection, Inco extIter = extensions.iterator(); while (extIter.hasNext()) { - Extension ext = extIter.next(); + AbstractExtension ext = extIter.next(); ext.setNextIncomingFrames(incoming); incoming = ext; } diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxControlBlock.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxControlBlock.java similarity index 93% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxControlBlock.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxControlBlock.java index b617b545b70..619c8a6abc5 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxControlBlock.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxControlBlock.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux; +package org.eclipse.jetty.websocket.common.extensions.mux; public interface MuxControlBlock { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxException.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxException.java similarity index 90% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxException.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxException.java index f7b13cc686a..7095bbd4daa 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxException.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxException.java @@ -16,9 +16,9 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux; +package org.eclipse.jetty.websocket.common.extensions.mux; -import org.eclipse.jetty.websocket.core.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketException; @SuppressWarnings("serial") public class MuxException extends WebSocketException diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxGenerator.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxGenerator.java similarity index 94% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxGenerator.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxGenerator.java index 96321a16f97..eb24e0245f5 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxGenerator.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxGenerator.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux; +package org.eclipse.jetty.websocket.common.extensions.mux; import java.io.IOException; import java.nio.ByteBuffer; @@ -26,13 +26,13 @@ import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.FutureCallback; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelRequest; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelResponse; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxDropChannel; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxFlowControl; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxNewChannelSlot; -import org.eclipse.jetty.websocket.core.io.OutgoingFrames; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelRequest; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxDropChannel; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxFlowControl; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxNewChannelSlot; +import org.eclipse.jetty.websocket.common.io.OutgoingFrames; /** * Generate Mux frames destined for the physical connection. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxOp.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxOp.java similarity index 94% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxOp.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxOp.java index 2b2af55e4df..331e39d0bd9 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxOp.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxOp.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux; +package org.eclipse.jetty.websocket.common.extensions.mux; public final class MuxOp { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParser.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParser.java similarity index 95% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParser.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParser.java index 939fcb34359..852836e2b2b 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParser.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParser.java @@ -16,20 +16,20 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux; +package org.eclipse.jetty.websocket.common.extensions.mux; import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelRequest; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelResponse; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxDropChannel; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxFlowControl; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxNewChannelSlot; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelRequest; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxDropChannel; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxFlowControl; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxNewChannelSlot; public class MuxParser { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxPhysicalConnectionException.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxPhysicalConnectionException.java similarity index 91% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxPhysicalConnectionException.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxPhysicalConnectionException.java index 23567cd2dca..8469d91f4ea 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxPhysicalConnectionException.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxPhysicalConnectionException.java @@ -16,9 +16,9 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux; +package org.eclipse.jetty.websocket.common.extensions.mux; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxDropChannel; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxDropChannel; public class MuxPhysicalConnectionException extends MuxException { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxRequest.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxRequest.java similarity index 92% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxRequest.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxRequest.java index e01313b1e77..06f45dfd222 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxRequest.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxRequest.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux; +package org.eclipse.jetty.websocket.common.extensions.mux; import java.nio.ByteBuffer; import java.util.List; @@ -24,8 +24,8 @@ import java.util.Map; import org.eclipse.jetty.util.QuotedStringTokenizer; import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.websocket.core.api.UpgradeRequest; -import org.eclipse.jetty.websocket.core.protocol.ExtensionConfig; +import org.eclipse.jetty.websocket.api.UpgradeRequest; +import org.eclipse.jetty.websocket.common.RequestedExtensionConfig; public class MuxRequest implements UpgradeRequest { @@ -64,7 +64,7 @@ public class MuxRequest implements UpgradeRequest private String queryString; private List subProtocols; private Map cookies; - private List extensions; + private List extensions; private Map> headers; private Map parameterMap; @@ -83,7 +83,7 @@ public class MuxRequest implements UpgradeRequest { for (String extConfig : extConfigs) { - extensions.add(ExtensionConfig.parse(extConfig)); + extensions.add(RequestedExtensionConfig.parse(extConfig)); } } @@ -94,7 +94,7 @@ public class MuxRequest implements UpgradeRequest } @Override - public List getExtensions() + public List getExtensions() { return extensions; } diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxResponse.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxResponse.java similarity index 87% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxResponse.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxResponse.java index 83e857fa2d5..3b37b0e6b25 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxResponse.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxResponse.java @@ -16,16 +16,16 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux; +package org.eclipse.jetty.websocket.common.extensions.mux; import java.io.IOException; import java.util.Iterator; import java.util.List; import java.util.Set; -import org.eclipse.jetty.websocket.core.api.UpgradeException; -import org.eclipse.jetty.websocket.core.api.UpgradeResponse; -import org.eclipse.jetty.websocket.core.protocol.ExtensionConfig; +import org.eclipse.jetty.websocket.api.UpgradeException; +import org.eclipse.jetty.websocket.api.UpgradeResponse; +import org.eclipse.jetty.websocket.common.RequestedExtensionConfig; public class MuxResponse implements UpgradeResponse { @@ -43,7 +43,7 @@ public class MuxResponse implements UpgradeResponse } @Override - public List getExtensions() + public List getExtensions() { // TODO Auto-generated method stub return null; @@ -106,7 +106,7 @@ public class MuxResponse implements UpgradeResponse } @Override - public void setExtensions(List extensions) + public void setExtensions(List extensions) { // TODO Auto-generated method stub diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxedFrame.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxedFrame.java similarity index 91% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxedFrame.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxedFrame.java index 4d17dafc7d0..80fd65795e7 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxedFrame.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxedFrame.java @@ -16,10 +16,10 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux; +package org.eclipse.jetty.websocket.common.extensions.mux; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; public class MuxedFrame extends WebSocketFrame { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/Muxer.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/Muxer.java similarity index 91% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/Muxer.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/Muxer.java index a7801e68795..ff05bbaf8e2 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/Muxer.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/Muxer.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux; +package org.eclipse.jetty.websocket.common.extensions.mux; import java.io.IOException; import java.net.InetSocketAddress; @@ -28,22 +28,22 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.StatusCode; -import org.eclipse.jetty.websocket.core.api.UpgradeRequest; -import org.eclipse.jetty.websocket.core.api.WebSocketBehavior; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.extensions.mux.add.MuxAddClient; -import org.eclipse.jetty.websocket.core.extensions.mux.add.MuxAddServer; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelRequest; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelResponse; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxDropChannel; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxFlowControl; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxNewChannelSlot; -import org.eclipse.jetty.websocket.core.io.IncomingFrames; -import org.eclipse.jetty.websocket.core.io.OutgoingFrames; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.StatusCode; +import org.eclipse.jetty.websocket.api.UpgradeRequest; +import org.eclipse.jetty.websocket.api.WebSocketBehavior; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.mux.add.MuxAddClient; +import org.eclipse.jetty.websocket.common.extensions.mux.add.MuxAddServer; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelRequest; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxDropChannel; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxFlowControl; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxNewChannelSlot; +import org.eclipse.jetty.websocket.common.io.IncomingFrames; +import org.eclipse.jetty.websocket.common.io.OutgoingFrames; /** * Muxer responsible for managing sub-channels. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/add/MuxAddClient.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxAddClient.java similarity index 82% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/add/MuxAddClient.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxAddClient.java index 035c76306db..a572063cbb8 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/add/MuxAddClient.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxAddClient.java @@ -16,10 +16,10 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux.add; +package org.eclipse.jetty.websocket.common.extensions.mux.add; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelResponse; -import org.eclipse.jetty.websocket.core.io.WebSocketSession; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.common.io.WebSocketSession; /** * Interface for Mux Client to handle receiving a AddChannelResponse diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/add/MuxAddServer.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxAddServer.java similarity index 78% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/add/MuxAddServer.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxAddServer.java index b01ad4c1a07..00f2a7d193d 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/add/MuxAddServer.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxAddServer.java @@ -16,16 +16,16 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux.add; +package org.eclipse.jetty.websocket.common.extensions.mux.add; import java.io.IOException; -import org.eclipse.jetty.websocket.core.api.UpgradeRequest; -import org.eclipse.jetty.websocket.core.api.UpgradeResponse; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxChannel; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxException; -import org.eclipse.jetty.websocket.core.extensions.mux.Muxer; -import org.eclipse.jetty.websocket.core.io.WebSocketSession; +import org.eclipse.jetty.websocket.api.UpgradeRequest; +import org.eclipse.jetty.websocket.api.UpgradeResponse; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxChannel; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxException; +import org.eclipse.jetty.websocket.common.extensions.mux.Muxer; +import org.eclipse.jetty.websocket.common.io.WebSocketSession; /** * Server interface, for dealing with incoming AddChannelRequest / AddChannelResponse flows. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxAddChannelRequest.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxAddChannelRequest.java similarity index 92% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxAddChannelRequest.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxAddChannelRequest.java index fa1db97662e..a86fb63cb4c 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxAddChannelRequest.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxAddChannelRequest.java @@ -16,14 +16,14 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux.op; +package org.eclipse.jetty.websocket.common.extensions.mux.op; import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxControlBlock; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxOp; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxControlBlock; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxOp; public class MuxAddChannelRequest implements MuxControlBlock { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxAddChannelResponse.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxAddChannelResponse.java similarity index 93% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxAddChannelResponse.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxAddChannelResponse.java index 699d57f71e7..9c840958b51 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxAddChannelResponse.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxAddChannelResponse.java @@ -16,14 +16,14 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux.op; +package org.eclipse.jetty.websocket.common.extensions.mux.op; import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxControlBlock; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxOp; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxControlBlock; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxOp; public class MuxAddChannelResponse implements MuxControlBlock { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxDropChannel.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxDropChannel.java similarity index 95% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxDropChannel.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxDropChannel.java index a93b13296f2..444a1e91aaa 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxDropChannel.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxDropChannel.java @@ -16,14 +16,14 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux.op; +package org.eclipse.jetty.websocket.common.extensions.mux.op; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxControlBlock; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxOp; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxControlBlock; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxOp; public class MuxDropChannel implements MuxControlBlock { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxFlowControl.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxFlowControl.java similarity index 88% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxFlowControl.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxFlowControl.java index afb8454f70f..ea7a19bf179 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxFlowControl.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxFlowControl.java @@ -16,10 +16,10 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux.op; +package org.eclipse.jetty.websocket.common.extensions.mux.op; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxControlBlock; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxOp; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxControlBlock; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxOp; public class MuxFlowControl implements MuxControlBlock { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxNewChannelSlot.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxNewChannelSlot.java similarity index 89% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxNewChannelSlot.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxNewChannelSlot.java index 903beb9a545..db4e4dccd47 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/mux/op/MuxNewChannelSlot.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxNewChannelSlot.java @@ -16,10 +16,10 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.extensions.mux.op; +package org.eclipse.jetty.websocket.common.extensions.mux.op; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxControlBlock; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxOp; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxControlBlock; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxOp; public class MuxNewChannelSlot implements MuxControlBlock { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/AbstractWebSocketConnection.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/AbstractWebSocketConnection.java similarity index 89% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/AbstractWebSocketConnection.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/AbstractWebSocketConnection.java index c61946c29ec..2ae321987bf 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/AbstractWebSocketConnection.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/AbstractWebSocketConnection.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io; +package org.eclipse.jetty.websocket.common.io; import java.io.IOException; import java.net.InetSocketAddress; @@ -24,6 +24,7 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executor; +import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; @@ -32,23 +33,21 @@ import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.util.BufferUtil; -import org.eclipse.jetty.util.Callback; -import org.eclipse.jetty.util.FutureCallback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.thread.Scheduler; -import org.eclipse.jetty.websocket.core.api.CloseException; -import org.eclipse.jetty.websocket.core.api.StatusCode; -import org.eclipse.jetty.websocket.core.api.SuspendToken; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.ConnectionState; -import org.eclipse.jetty.websocket.core.protocol.ExtensionConfig; -import org.eclipse.jetty.websocket.core.protocol.Generator; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.Parser; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.CloseException; +import org.eclipse.jetty.websocket.api.StatusCode; +import org.eclipse.jetty.websocket.api.SuspendToken; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.extensions.Frame; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.ConnectionState; +import org.eclipse.jetty.websocket.common.Generator; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.Parser; +import org.eclipse.jetty.websocket.common.RequestedExtensionConfig; /** * Provides the implementation of {@link WebSocketConnection} within the framework of the new {@link Connection} framework of jetty-io @@ -66,7 +65,7 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp private final FrameQueue queue; private final AtomicBoolean suspendToken; private WebSocketSession session; - private List extensions; + private List extensions; private boolean flushing; private boolean isFilling; private ConnectionState connectionState; @@ -147,8 +146,7 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp private void enqueClose(int statusCode, String reason) { CloseInfo close = new CloseInfo(statusCode,reason); - FutureCallback nop = new FutureCallback<>(); - output(null,nop,close.asFrame()); + output(null,close.asFrame()); } public void flush() @@ -208,7 +206,7 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp * * @return the list of negotiated extensions in use. */ - public List getExtensions() + public List getExtensions() { return extensions; } @@ -365,24 +363,24 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp * Enqueue internal frame from {@link OutgoingFrames} stack for eventual write out on the physical connection. */ @Override - public void output(C context, Callback callback, WebSocketFrame frame) + public Future output(C context, Frame frame) { if (LOG.isDebugEnabled()) { - LOG.debug("output({}, {}, {})",context,callback,frame); + LOG.debug("output({}, {})",context,frame); } synchronized (queue) { FrameBytes bytes = null; - if (frame.isControlFrame()) + if (frame.getType().isControl()) { - bytes = new ControlFrameBytes(this,callback,context,frame); + bytes = new ControlFrameBytes(this,context,frame); } else { - bytes = new DataFrameBytes(this,callback,context,frame); + bytes = new DataFrameBytes(this,context,frame); } scheduleTimeout(bytes); @@ -468,11 +466,12 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp * @param extensions * the list of negotiated extensions in use. */ - public void setExtensions(List extensions) + public void setExtensions(List extensions) { this.extensions = extensions; } + @Override public void setSession(WebSocketSession session) { this.session = session; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/ControlFrameBytes.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/ControlFrameBytes.java similarity index 90% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/ControlFrameBytes.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/ControlFrameBytes.java index 510030d5c85..9a72d1fe3ad 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/ControlFrameBytes.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/ControlFrameBytes.java @@ -16,16 +16,16 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io; +package org.eclipse.jetty.websocket.common.io; import java.nio.ByteBuffer; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; public class ControlFrameBytes extends FrameBytes { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/DataFrameBytes.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/DataFrameBytes.java similarity index 95% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/DataFrameBytes.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/DataFrameBytes.java index 2dfb2674f1c..50672737929 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/DataFrameBytes.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/DataFrameBytes.java @@ -16,14 +16,14 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io; +package org.eclipse.jetty.websocket.common.io; import java.nio.ByteBuffer; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.common.WebSocketFrame; public class DataFrameBytes extends FrameBytes { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/FrameBytes.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FrameBytes.java similarity index 96% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/FrameBytes.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FrameBytes.java index c3938a99f13..ae108e5f768 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/FrameBytes.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FrameBytes.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io; +package org.eclipse.jetty.websocket.common.io; import java.nio.ByteBuffer; import java.nio.channels.InterruptedByTimeoutException; @@ -26,7 +26,7 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.thread.Scheduler; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.common.WebSocketFrame; public abstract class FrameBytes implements Callback, Runnable { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/FrameQueue.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FrameQueue.java similarity index 95% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/FrameQueue.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FrameQueue.java index 22331e3b695..c3ff53c0d2f 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/FrameQueue.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/FrameQueue.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io; +package org.eclipse.jetty.websocket.common.io; import java.util.LinkedList; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/IncomingFrames.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/IncomingFrames.java similarity index 84% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/IncomingFrames.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/IncomingFrames.java index 776d67cfa36..b3c83662621 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/IncomingFrames.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/IncomingFrames.java @@ -16,10 +16,10 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io; +package org.eclipse.jetty.websocket.common.io; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.common.WebSocketFrame; /** * Interface for dealing with Incoming Frames. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/InternalConnection.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/InternalConnection.java similarity index 79% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/InternalConnection.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/InternalConnection.java index 554c9094a54..9b918a1fa5a 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/InternalConnection.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/InternalConnection.java @@ -16,16 +16,16 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io; +package org.eclipse.jetty.websocket.common.io; import java.util.List; -import org.eclipse.jetty.websocket.core.api.Extension; -import org.eclipse.jetty.websocket.core.api.LogicalConnection; +import org.eclipse.jetty.websocket.common.LogicalConnection; +import org.eclipse.jetty.websocket.common.extensions.AbstractExtension; public interface InternalConnection extends LogicalConnection { - void configureFromExtensions(List extensions); + void configureFromExtensions(List extensions); void setIncoming(IncomingFrames incoming); diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/OutgoingFrames.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/OutgoingFrames.java similarity index 74% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/OutgoingFrames.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/OutgoingFrames.java index 96610b0e659..7e1a7f01458 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/OutgoingFrames.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/OutgoingFrames.java @@ -16,17 +16,17 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io; +package org.eclipse.jetty.websocket.common.io; import java.io.IOException; +import java.util.concurrent.Future; -import org.eclipse.jetty.util.Callback; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.extensions.Frame; /** - * Interface for dealing with outgoing frames. + * Interface for dealing with frames outgoing to the network (eventually) */ public interface OutgoingFrames { - void output(C context, Callback callback, WebSocketFrame frame) throws IOException; + Future output(C context, Frame frame) throws IOException; } diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/WebSocketSession.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/WebSocketSession.java similarity index 79% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/WebSocketSession.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/WebSocketSession.java index f98a21200fe..4e0b2674106 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/WebSocketSession.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/WebSocketSession.java @@ -16,28 +16,30 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io; +package org.eclipse.jetty.websocket.common.io; import java.io.IOException; import java.net.InetSocketAddress; +import java.net.URI; import java.nio.ByteBuffer; +import java.util.concurrent.Future; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.LogicalConnection; -import org.eclipse.jetty.websocket.core.api.SuspendToken; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.io.event.EventDriver; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.ConnectionState; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.SuspendToken; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.ConnectionState; +import org.eclipse.jetty.websocket.common.LogicalConnection; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.io.event.EventDriver; -public class WebSocketSession implements WebSocketConnection, IncomingFrames, OutgoingFrames +public class WebSocketSession implements WebSocketConnection, LogicalConnection, IncomingFrames, OutgoingFrames { private static final Logger LOG = Log.getLogger(WebSocketSession.class); @@ -84,6 +86,13 @@ public class WebSocketSession implements WebSocketConnection, IncomingFrames, Ou return websocket; } + @Override + public InetSocketAddress getLocalAddress() + { + // TODO Auto-generated method stub + return null; + } + public OutgoingFrames getOutgoing() { return outgoing; @@ -101,6 +110,13 @@ public class WebSocketSession implements WebSocketConnection, IncomingFrames, Ou return baseConnection.getRemoteAddress(); } + @Override + public URI getRequestURI() + { + // TODO Auto-generated method stub + return null; + } + @Override public ConnectionState getState() { @@ -172,22 +188,21 @@ public class WebSocketSession implements WebSocketConnection, IncomingFrames, Ou websocket.onConnect(); } - @Override - public void output(C context, Callback callback, WebSocketFrame frame) throws IOException + public Future output(C context, WebSocketFrame frame) throws IOException { if (LOG.isDebugEnabled()) { - LOG.debug("output({},{},{}) - {}",context,callback,frame,outgoing); + LOG.debug("output({},{}) - {}",context,frame,outgoing); } // forward on to chain - outgoing.output(context,callback,frame); + return outgoing.output(context,frame); } /** * {@inheritDoc} */ @Override - public void ping(C context, Callback callback, byte[] payload) throws IOException + public Future ping(C context, byte[] payload) throws IOException { // Delegate the application called ping to the OutgoingFrames interface to allow // extensions to process the frame appropriately. @@ -223,6 +238,20 @@ public class WebSocketSession implements WebSocketConnection, IncomingFrames, Ou return builder.toString(); } + @Override + public Future write(C context, byte[] buf, int offset, int len) throws IOException + { + // TODO Auto-generated method stub + return null; + } + + @Override + public Future write(C context, ByteBuffer buffer) throws IOException + { + // TODO Auto-generated method stub + return null; + } + /** * {@inheritDoc} */ @@ -285,4 +314,11 @@ public class WebSocketSession implements WebSocketConnection, IncomingFrames, Ou frame.setFin(true); output(context,callback,frame); } + + @Override + public Future write(C context, String message) throws IOException + { + // TODO Auto-generated method stub + return null; + } } diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/AnnotatedEventDriver.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/AnnotatedEventDriver.java similarity index 86% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/AnnotatedEventDriver.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/AnnotatedEventDriver.java index 156b0f107aa..c6c5f6f9b17 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/AnnotatedEventDriver.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/AnnotatedEventDriver.java @@ -16,23 +16,23 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.event; +package org.eclipse.jetty.websocket.common.io.event; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.nio.ByteBuffer; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.io.message.MessageAppender; -import org.eclipse.jetty.websocket.core.io.message.MessageInputStream; -import org.eclipse.jetty.websocket.core.io.message.MessageReader; -import org.eclipse.jetty.websocket.core.io.message.SimpleBinaryMessage; -import org.eclipse.jetty.websocket.core.io.message.SimpleTextMessage; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; +import org.eclipse.jetty.websocket.api.extensions.Frame; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.io.message.MessageAppender; +import org.eclipse.jetty.websocket.common.io.message.MessageInputStream; +import org.eclipse.jetty.websocket.common.io.message.MessageReader; +import org.eclipse.jetty.websocket.common.io.message.SimpleBinaryMessage; +import org.eclipse.jetty.websocket.common.io.message.SimpleTextMessage; /** * Handler for Annotated User WebSocket objects. @@ -134,7 +134,7 @@ public class AnnotatedEventDriver extends EventDriver } @Override - public void onFrame(WebSocketFrame frame) + public void onFrame(Frame frame) { if (events.onFrame != null) { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/EventDriver.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/EventDriver.java similarity index 86% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/EventDriver.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/EventDriver.java index 00fb6694ea2..1e1e4b7baa9 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/EventDriver.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/EventDriver.java @@ -16,31 +16,31 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.event; +package org.eclipse.jetty.websocket.common.io.event; import java.io.IOException; import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; -import org.eclipse.jetty.util.FutureCallback; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.Utf8Appendable.NotUtf8Exception; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.CloseException; -import org.eclipse.jetty.websocket.core.api.StatusCode; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.io.IncomingFrames; -import org.eclipse.jetty.websocket.core.io.WebSocketSession; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.CloseException; +import org.eclipse.jetty.websocket.api.StatusCode; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.extensions.Frame; +import org.eclipse.jetty.websocket.api.extensions.FrameHandler; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.io.WebSocketSession; /** * EventDriver is the main interface between the User's WebSocket POJO and the internal jetty implementation of WebSocket. */ -public abstract class EventDriver implements IncomingFrames +public abstract class EventDriver implements FrameHandler { protected final Logger LOG; protected final WebSocketPolicy policy; @@ -65,24 +65,7 @@ public abstract class EventDriver implements IncomingFrames } @Override - public final void incoming(WebSocketException e) - { - if (LOG.isDebugEnabled()) - { - LOG.debug("incoming(WebSocketException)",e); - } - - if (e instanceof CloseException) - { - CloseException close = (CloseException)e; - terminateConnection(close.getStatusCode(),close.getMessage()); - } - - onException(e); - } - - @Override - public final void incoming(WebSocketFrame frame) + public void handleFrame(Frame frame) { if (LOG.isDebugEnabled()) { @@ -127,7 +110,7 @@ public abstract class EventDriver implements IncomingFrames LOG.debug("Pong with {}",BufferUtil.toDetailString(pongBuf)); } } - session.output("pong",new FutureCallback(),pong); + session.output("pong",pong); break; } case OpCode.BINARY: @@ -156,6 +139,23 @@ public abstract class EventDriver implements IncomingFrames } } + // FIXME: need flow of exceptions ... + public final void incoming(WebSocketException e) + { + if (LOG.isDebugEnabled()) + { + LOG.debug("incoming(WebSocketException)",e); + } + + if (e instanceof CloseException) + { + CloseException close = (CloseException)e; + terminateConnection(close.getStatusCode(),close.getMessage()); + } + + onException(e); + } + public abstract void onBinaryFrame(ByteBuffer buffer, boolean fin) throws IOException; public abstract void onBinaryMessage(byte[] data); @@ -166,7 +166,7 @@ public abstract class EventDriver implements IncomingFrames public abstract void onException(WebSocketException e); - public abstract void onFrame(WebSocketFrame frame); + public abstract void onFrame(Frame frame); public abstract void onTextFrame(ByteBuffer buffer, boolean fin) throws IOException; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/EventDriverFactory.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/EventDriverFactory.java similarity index 94% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/EventDriverFactory.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/EventDriverFactory.java index 1e530871d8b..472aff0cfac 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/EventDriverFactory.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/EventDriverFactory.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.event; +package org.eclipse.jetty.websocket.common.io.event; import java.io.InputStream; import java.io.Reader; @@ -26,16 +26,16 @@ import java.lang.reflect.Modifier; import java.util.concurrent.ConcurrentHashMap; import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketClose; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketConnect; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketFrame; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.api.InvalidWebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.api.WebSocketListener; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.Frame; +import org.eclipse.jetty.websocket.api.InvalidWebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketListener; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketFrame; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; +import org.eclipse.jetty.websocket.api.extensions.Frame; /** * Create EventDriver implementations. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/EventMethod.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/EventMethod.java similarity index 96% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/EventMethod.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/EventMethod.java index cb6f881230f..c0a813cb6cc 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/EventMethod.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/EventMethod.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.event; +package org.eclipse.jetty.websocket.common.io.event; import java.io.InputStream; import java.io.Reader; @@ -25,8 +25,8 @@ import java.lang.reflect.Method; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketException; public class EventMethod { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/EventMethods.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/EventMethods.java similarity index 98% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/EventMethods.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/EventMethods.java index da4cb2ec7b5..22ec45ca742 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/EventMethods.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/EventMethods.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.event; +package org.eclipse.jetty.websocket.common.io.event; /** * A representation of the methods available to call for a particular class. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/InvalidSignatureException.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/InvalidSignatureException.java similarity index 95% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/InvalidSignatureException.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/InvalidSignatureException.java index 98e51b86e30..e557a46e469 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/InvalidSignatureException.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/InvalidSignatureException.java @@ -16,13 +16,13 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.event; +package org.eclipse.jetty.websocket.common.io.event; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.websocket.core.api.InvalidWebSocketException; +import org.eclipse.jetty.websocket.api.InvalidWebSocketException; @SuppressWarnings("serial") public class InvalidSignatureException extends InvalidWebSocketException diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/ListenerEventDriver.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/ListenerEventDriver.java similarity index 82% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/ListenerEventDriver.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/ListenerEventDriver.java index db5b2dd0326..0dd48937d01 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/ListenerEventDriver.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/ListenerEventDriver.java @@ -16,19 +16,19 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.event; +package org.eclipse.jetty.websocket.common.io.event; import java.io.IOException; import java.nio.ByteBuffer; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketListener; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.io.message.MessageAppender; -import org.eclipse.jetty.websocket.core.io.message.SimpleBinaryMessage; -import org.eclipse.jetty.websocket.core.io.message.SimpleTextMessage; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketListener; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.extensions.Frame; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.io.message.MessageAppender; +import org.eclipse.jetty.websocket.common.io.message.SimpleBinaryMessage; +import org.eclipse.jetty.websocket.common.io.message.SimpleTextMessage; /** * Handler for {@link WebSocketListener} based User WebSocket implementations. @@ -89,7 +89,7 @@ public class ListenerEventDriver extends EventDriver } @Override - public void onFrame(WebSocketFrame frame) + public void onFrame(Frame frame) { /* ignore, not supported by WebSocketListener */ } diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/ParamList.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/ParamList.java similarity index 95% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/ParamList.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/ParamList.java index 4550e83cf8a..797a238fcd7 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/event/ParamList.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/event/ParamList.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.event; +package org.eclipse.jetty.websocket.common.io.event; import java.util.ArrayList; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/MessageAppender.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/MessageAppender.java similarity index 96% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/MessageAppender.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/MessageAppender.java index 2df38db86d7..edc22c74300 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/MessageAppender.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/MessageAppender.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.message; +package org.eclipse.jetty.websocket.common.io.message; import java.io.IOException; import java.nio.ByteBuffer; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/MessageInputStream.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/MessageInputStream.java similarity index 96% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/MessageInputStream.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/MessageInputStream.java index 25867ed1043..f3bd0ceb631 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/MessageInputStream.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/MessageInputStream.java @@ -16,14 +16,14 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.message; +package org.eclipse.jetty.websocket.common.io.message; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; -import org.eclipse.jetty.websocket.core.io.event.AnnotatedEventDriver; +import org.eclipse.jetty.websocket.common.io.event.AnnotatedEventDriver; /** * Support class for reading binary message data as an InputStream. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/MessageReader.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/MessageReader.java similarity index 95% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/MessageReader.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/MessageReader.java index 4e4cc6057ee..60877b20082 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/MessageReader.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/MessageReader.java @@ -16,14 +16,14 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.message; +package org.eclipse.jetty.websocket.common.io.message; import java.io.IOException; import java.io.Reader; import java.nio.ByteBuffer; import org.eclipse.jetty.util.Utf8StringBuilder; -import org.eclipse.jetty.websocket.core.io.event.AnnotatedEventDriver; +import org.eclipse.jetty.websocket.common.io.event.AnnotatedEventDriver; /** * Support class for reading text message data as an Reader. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/SimpleBinaryMessage.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/SimpleBinaryMessage.java similarity index 94% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/SimpleBinaryMessage.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/SimpleBinaryMessage.java index 340e56c6a5f..944e0374ec1 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/SimpleBinaryMessage.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/SimpleBinaryMessage.java @@ -16,14 +16,14 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.message; +package org.eclipse.jetty.websocket.common.io.message; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; -import org.eclipse.jetty.websocket.core.io.event.EventDriver; +import org.eclipse.jetty.websocket.common.io.event.EventDriver; public class SimpleBinaryMessage implements MessageAppender { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/SimpleTextMessage.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/SimpleTextMessage.java similarity index 94% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/SimpleTextMessage.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/SimpleTextMessage.java index 1b841f4b93d..8d39296cbf1 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/message/SimpleTextMessage.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/message/SimpleTextMessage.java @@ -16,13 +16,13 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.message; +package org.eclipse.jetty.websocket.common.io.message; import java.io.IOException; import java.nio.ByteBuffer; import org.eclipse.jetty.util.Utf8StringBuilder; -import org.eclipse.jetty.websocket.core.io.event.EventDriver; +import org.eclipse.jetty.websocket.common.io.event.EventDriver; public class SimpleTextMessage implements MessageAppender { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/CloseReasonValidator.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/CloseReasonValidator.java similarity index 92% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/CloseReasonValidator.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/CloseReasonValidator.java index b6f5c29f34a..85bd4b538d7 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/CloseReasonValidator.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/CloseReasonValidator.java @@ -16,11 +16,11 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.payload; +package org.eclipse.jetty.websocket.common.io.payload; import java.nio.ByteBuffer; -import org.eclipse.jetty.websocket.core.protocol.OpCode; +import org.eclipse.jetty.websocket.common.OpCode; /** * Validate UTF8 correctness for {@link OpCode#CLOSE} Reason message. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/DeMaskProcessor.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/DeMaskProcessor.java similarity index 93% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/DeMaskProcessor.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/DeMaskProcessor.java index d202cb90c77..06af5e8e9b1 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/DeMaskProcessor.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/DeMaskProcessor.java @@ -16,11 +16,11 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.payload; +package org.eclipse.jetty.websocket.common.io.payload; import java.nio.ByteBuffer; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.common.WebSocketFrame; public class DeMaskProcessor implements PayloadProcessor { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/NoOpValidator.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/NoOpValidator.java similarity index 91% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/NoOpValidator.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/NoOpValidator.java index 76ece6d8762..0d549620408 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/NoOpValidator.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/NoOpValidator.java @@ -16,11 +16,11 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.payload; +package org.eclipse.jetty.websocket.common.io.payload; import java.nio.ByteBuffer; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.common.WebSocketFrame; /** * payload validator does no validation. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/PayloadProcessor.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/PayloadProcessor.java similarity index 87% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/PayloadProcessor.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/PayloadProcessor.java index 6b47d9eaa05..b8aee5be886 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/PayloadProcessor.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/PayloadProcessor.java @@ -16,12 +16,12 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.payload; +package org.eclipse.jetty.websocket.common.io.payload; import java.nio.ByteBuffer; -import org.eclipse.jetty.websocket.core.api.BadPayloadException; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.BadPayloadException; +import org.eclipse.jetty.websocket.common.WebSocketFrame; /** * Process the payload (for demasking, validating, etc..) diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/UTF8Validator.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/UTF8Validator.java similarity index 93% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/UTF8Validator.java rename to jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/UTF8Validator.java index 429e5b5196d..c60e130ffea 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/payload/UTF8Validator.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/io/payload/UTF8Validator.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core.io.payload; +package org.eclipse.jetty.websocket.common.io.payload; import java.io.IOException; import java.nio.ByteBuffer; @@ -25,8 +25,8 @@ import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Utf8Appendable; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.BadPayloadException; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.BadPayloadException; +import org.eclipse.jetty.websocket.common.WebSocketFrame; /** * Used to perform validation of UTF8 payload contents (for fast-fail reasons) diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketClose.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketClose.java deleted file mode 100644 index 0edc6571cfa..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketClose.java +++ /dev/null @@ -1,46 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; - -/** - * Annotation for tagging methods to receive connection close events. - *

- * Acceptable method patterns.
- * Note: methodName can be any name you want to use. - *

    - *
  1. public void methodName(int statusCode, String reason)
  2. - *
  3. public void methodName({@link WebSocketConnection} conn, int statusCode, String reason)
  4. - *
- */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(value = -{ ElementType.METHOD }) -public @interface OnWebSocketClose -{ - /* no config */ -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketConnect.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketConnect.java deleted file mode 100644 index 220bae70968..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketConnect.java +++ /dev/null @@ -1,45 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; - -/** - * Annotation for tagging methods to receive connection open events. - *

- * Only 1 acceptable method pattern for this annotation.
- * Note: methodName can be any name you want to use. - *

    - *
  1. public void methodName({@link WebSocketConnection} conn)
  2. - *
- */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(value = -{ ElementType.METHOD }) -public @interface OnWebSocketConnect -{ - /* no config */ -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketFrame.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketFrame.java deleted file mode 100644 index 713949002d0..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketFrame.java +++ /dev/null @@ -1,49 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; - -/** - * (ADVANCED) Annotation for tagging methods to receive frame events. - *

- * Note: any frame derived from {@link WebSocketFrame} is acceptable to use as the last parameter here. - *

- * Acceptable method patterns.
- * Note: methodName can be any name you want to use. - *

    - *
  1. public void methodName({@link WebSocketFrame} frame)
  2. - *
  3. public void methodName({@link WebSocketConnection} conn, {@link WebSocketFrame} frame)
  4. - *
- */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(value = -{ ElementType.METHOD }) -public @interface OnWebSocketFrame -{ - /* no config */ -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketMessage.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketMessage.java deleted file mode 100644 index adad17f1b0d..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/OnWebSocketMessage.java +++ /dev/null @@ -1,61 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.annotations; - -import java.io.Reader; -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; - -/** - * Annotation for tagging methods to receive Binary or Text Message events. - *

- * Acceptable method patterns.
- * Note: methodName can be any name you want to use. - *

- * Text Message Versions - *

    - *
  1. public void methodName(String text)
  2. - *
  3. public void methodName({@link WebSocketConnection} conn, String text)
  4. - *
  5. public void methodName(Reader reader)
  6. - *
  7. public void methodName({@link WebSocketConnection} conn, Reader reader)
  8. - *
- * Note: that the {@link Reader} in this case will always use UTF-8 encoding/charset (this is dictated by the RFC 6455 spec for Text Messages. If you need to - * use a non-UTF-8 encoding/charset, you are instructed to use the binary messaging techniques. - *

- * Binary Message Versions - *

    - *
  1. public void methodName(byte buf[], int offset, int length)
  2. - *
  3. public void methodName({@link WebSocketConnection} conn, byte buf[], int offset, int length)
  4. - *
  5. public void methodName(InputStream stream)
  6. - *
  7. public void methodName({@link WebSocketConnection} conn, InputStream stream)
  8. - *
- */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(value = -{ ElementType.METHOD }) -public @interface OnWebSocketMessage -{ - /* no config */ -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/WebSocket.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/WebSocket.java deleted file mode 100644 index 6968720c0a3..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/annotations/WebSocket.java +++ /dev/null @@ -1,43 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Tags a POJO as being a WebSocket class. - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(value = -{ ElementType.TYPE }) -public @interface WebSocket -{ - int maxBinarySize() default -2; - - int maxBufferSize() default -2; - - int maxIdleTime() default -2; - - int maxTextSize() default -2; -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/BadPayloadException.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/BadPayloadException.java deleted file mode 100644 index af6dd820973..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/BadPayloadException.java +++ /dev/null @@ -1,46 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -import org.eclipse.jetty.websocket.core.extensions.compress.PerMessageCompressionExtension; - -/** - * Exception to terminate the connection because it has received data within a frame payload that was not consistent with the requirements of that frame - * payload. (eg: not UTF-8 in a text frame, or a bad data seen in the {@link PerMessageCompressionExtension}) - * - * @see StatusCode#BAD_PAYLOAD - */ -@SuppressWarnings("serial") -public class BadPayloadException extends CloseException -{ - public BadPayloadException(String message) - { - super(StatusCode.BAD_PAYLOAD,message); - } - - public BadPayloadException(String message, Throwable t) - { - super(StatusCode.BAD_PAYLOAD,message,t); - } - - public BadPayloadException(Throwable t) - { - super(StatusCode.BAD_PAYLOAD,t); - } -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/CloseException.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/CloseException.java deleted file mode 100644 index d635612ed71..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/CloseException.java +++ /dev/null @@ -1,49 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -@SuppressWarnings("serial") -public class CloseException extends WebSocketException -{ - private int statusCode; - - public CloseException(int closeCode, String message) - { - super(message); - this.statusCode = closeCode; - } - - public CloseException(int closeCode, String message, Throwable cause) - { - super(message,cause); - this.statusCode = closeCode; - } - - public CloseException(int closeCode, Throwable cause) - { - super(cause); - this.statusCode = closeCode; - } - - public int getStatusCode() - { - return statusCode; - } - -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/InvalidWebSocketException.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/InvalidWebSocketException.java deleted file mode 100644 index 51475e056f4..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/InvalidWebSocketException.java +++ /dev/null @@ -1,45 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -import org.eclipse.jetty.websocket.core.annotations.WebSocket; - -/** - * Indicating that the provided Class is not a valid WebSocket as defined by the API. - *

- * A valid WebSocket should do one of the following: - *

    - *
  • Implement {@link WebSocketListener}
  • - *
  • Extend {@link WebSocketAdapter}
  • - *
  • Declare the {@link WebSocket @WebSocket} annotation on the type
  • - *
- */ -@SuppressWarnings("serial") -public class InvalidWebSocketException extends WebSocketException -{ - public InvalidWebSocketException(String message) - { - super(message); - } - - public InvalidWebSocketException(String message, Throwable cause) - { - super(message,cause); - } -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/MessageTooLargeException.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/MessageTooLargeException.java deleted file mode 100644 index bae0b86b0de..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/MessageTooLargeException.java +++ /dev/null @@ -1,43 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -/** - * Exception when a message is too large for the internal buffers occurs and should trigger a connection close. - * - * @see StatusCode#MESSAGE_TOO_LARGE - */ -@SuppressWarnings("serial") -public class MessageTooLargeException extends CloseException -{ - public MessageTooLargeException(String message) - { - super(StatusCode.MESSAGE_TOO_LARGE,message); - } - - public MessageTooLargeException(String message, Throwable t) - { - super(StatusCode.MESSAGE_TOO_LARGE,message,t); - } - - public MessageTooLargeException(Throwable t) - { - super(StatusCode.MESSAGE_TOO_LARGE,t); - } -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/PolicyViolationException.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/PolicyViolationException.java deleted file mode 100644 index f7d1e25eb48..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/PolicyViolationException.java +++ /dev/null @@ -1,43 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -/** - * Exception when a violation of policy occurs and should trigger a connection close. - * - * @see StatusCode#POLICY_VIOLATION - */ -@SuppressWarnings("serial") -public class PolicyViolationException extends CloseException -{ - public PolicyViolationException(String message) - { - super(StatusCode.POLICY_VIOLATION,message); - } - - public PolicyViolationException(String message, Throwable t) - { - super(StatusCode.POLICY_VIOLATION,message,t); - } - - public PolicyViolationException(Throwable t) - { - super(StatusCode.POLICY_VIOLATION,t); - } -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/ProtocolException.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/ProtocolException.java deleted file mode 100644 index 640f0c40a0f..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/ProtocolException.java +++ /dev/null @@ -1,41 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -/** - * Per spec, a protocol error should result in a Close frame of status code 1002 (PROTOCOL_ERROR) - */ -@SuppressWarnings("serial") -public class ProtocolException extends CloseException -{ - public ProtocolException(String message) - { - super(StatusCode.PROTOCOL,message); - } - - public ProtocolException(String message, Throwable t) - { - super(StatusCode.PROTOCOL,message,t); - } - - public ProtocolException(Throwable t) - { - super(StatusCode.PROTOCOL,t); - } -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/StatusCode.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/StatusCode.java deleted file mode 100644 index 98349daf6a0..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/StatusCode.java +++ /dev/null @@ -1,141 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -/** - * The RFC 6455 specified status codes and IANA: WebSocket Close Code Number Registry - */ -public class StatusCode -{ - /** - * 1000 indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled. - *

- * See RFC 6455, Section 7.4.1 Defined Status Codes. - */ - public final static int NORMAL = 1000; - - /** - * 1001 indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page. - *

- * See RFC 6455, Section 7.4.1 Defined Status Codes. - */ - public final static int SHUTDOWN = 1001; - - /** - * 1002 indicates that an endpoint is terminating the connection due to a protocol error. - *

- * See RFC 6455, Section 7.4.1 Defined Status Codes. - */ - public final static int PROTOCOL = 1002; - - /** - * 1003 indicates that an endpoint is terminating the connection because it has received a type of data it cannot accept (e.g., an endpoint that understands - * only text data MAY send this if it receives a binary message). - *

- * See RFC 6455, Section 7.4.1 Defined Status Codes. - */ - public final static int BAD_DATA = 1003; - - /** - * Reserved. The specific meaning might be defined in the future. - *

- * See RFC 6455, Section 7.4.1 Defined Status Codes. - */ - public final static int UNDEFINED = 1004; - - /** - * 1005 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is designated for use in applications expecting - * a status code to indicate that no status code was actually present. - *

- * See RFC 6455, Section 7.4.1 Defined Status Codes. - */ - public final static int NO_CODE = 1005; - - /** - * 1006 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is designated for use in applications expecting - * a status code to indicate that the connection was closed abnormally, e.g., without sending or receiving a Close control frame. - *

- * See RFC 6455, Section 7.4.1 Defined Status Codes. - */ - public final static int NO_CLOSE = 1006; - - /** - * 1007 indicates that an endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the - * message (e.g., non-UTF-8 [RFC3629] data within a text message). - *

- * See RFC 6455, Section 7.4.1 Defined Status Codes. - */ - public final static int BAD_PAYLOAD = 1007; - - /** - * 1008 indicates that an endpoint is terminating the connection because it has received a message that violates its policy. This is a generic status code - * that can be returned when there is no other more suitable status code (e.g., 1003 or 1009) or if there is a need to hide specific details about the - * policy. - *

- * See RFC 6455, Section 7.4.1 Defined Status Codes. - */ - public final static int POLICY_VIOLATION = 1008; - - /** - * 1009 indicates that an endpoint is terminating the connection because it has received a message that is too big for it to process. - *

- * See RFC 6455, Section 7.4.1 Defined Status Codes. - */ - public final static int MESSAGE_TOO_LARGE = 1009; - - /** - * 1010 indicates that an endpoint (client) is terminating the connection because it has expected the server to negotiate one or more extension, but the - * server didn't return them in the response message of the WebSocket handshake. The list of extensions that are needed SHOULD appear in the /reason/ part - * of the Close frame. Note that this status code is not used by the server, because it can fail the WebSocket handshake instead. - *

- * See RFC 6455, Section 7.4.1 Defined Status Codes. - */ - public final static int REQUIRED_EXTENSION = 1010; - - /** - * 1011 indicates that a server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request. - *

- * See RFC 6455, Section 7.4.1 Defined Status Codes. - */ - public final static int SERVER_ERROR = 1011; - - /** - * 1012 indicates that the service is restarted. a client may reconnect, and if it chooses to do, should reconnect using a randomized delay of 5 - 30s. - *

- * See [hybi] Additional WebSocket Close Error Codes - */ - public final static int SERVICE_RESTART = 1012; - - /** - * 1013 indicates that the service is experiencing overload. a client should only connect to a different IP (when there are multiple for the target) or - * reconnect to the same IP upon user action. - *

- * See [hybi] Additional WebSocket Close Error Codes - */ - public final static int TRY_AGAIN_LATER = 1013; - - /** - * 1015 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is designated for use in applications expecting - * a status code to indicate that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified). - *

- * See RFC 6455, Section 7.4.1 Defined Status Codes. - */ - public final static int FAILED_TLS_HANDSHAKE = 1015; -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/SuspendToken.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/SuspendToken.java deleted file mode 100644 index e8a7738b71c..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/SuspendToken.java +++ /dev/null @@ -1,30 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -/** - * Connection suspend token - */ -public interface SuspendToken -{ - /** - * Resume a previously suspended connection. - */ - void resume(); -} \ No newline at end of file diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/UpgradeException.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/UpgradeException.java deleted file mode 100644 index f9a798a2060..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/UpgradeException.java +++ /dev/null @@ -1,46 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -/** - * Exception during WebSocket Upgrade Handshake. - */ -@SuppressWarnings("serial") -public class UpgradeException extends WebSocketException -{ - public UpgradeException() - { - super(); - } - - public UpgradeException(String message) - { - super(message); - } - - public UpgradeException(String message, Throwable cause) - { - super(message,cause); - } - - public UpgradeException(Throwable cause) - { - super(cause); - } -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/UpgradeRequest.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/UpgradeRequest.java deleted file mode 100644 index 847b447ab39..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/UpgradeRequest.java +++ /dev/null @@ -1,59 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -import java.util.List; -import java.util.Map; - -import org.eclipse.jetty.websocket.core.protocol.ExtensionConfig; - -public interface UpgradeRequest -{ - public void addExtensions(String... extConfigs); - - public Map getCookieMap(); - - public List getExtensions(); - - public String getHeader(String name); - - public Map> getHeaders(); - - public String getHost(); - - public String getHttpVersion(); - - public String getMethod(); - - public String getOrigin(); - - public Map getParameterMap(); - - public String getQueryString(); - - public String getRemoteURI(); - - public List getSubProtocols(); - - public boolean hasSubProtocol(String test); - - public boolean isOrigin(String test); - - public void setSubProtocols(String protocols); -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/UpgradeResponse.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/UpgradeResponse.java deleted file mode 100644 index 76417a01dcc..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/UpgradeResponse.java +++ /dev/null @@ -1,99 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -import java.io.IOException; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.jetty.websocket.core.protocol.ExtensionConfig; - -public interface UpgradeResponse -{ - public void addHeader(String name, String value); - - /** - * Get the accepted WebSocket protocol. - * - * @return the accepted WebSocket protocol. - */ - public String getAcceptedSubProtocol(); - - /** - * Get the list of extensions that should be used for the websocket. - * - * @return the list of negotiated extensions to use. - */ - public List getExtensions(); - - public Set getHeaderNamesSet(); - - public String getHeaderValue(String name); - - public Iterator getHeaderValues(String name); - - public int getStatusCode(); - - public String getStatusReason(); - - public boolean isSuccess(); - - /** - * Issue a forbidden upgrade response. - *

- * This means that the websocket endpoint was valid, but the conditions to use a WebSocket resulted in a forbidden access. - *

- * Use this when the origin or authentication is invalid. - * - * @param message - * the short 1 line detail message about the forbidden response - * @throws IOException - */ - public void sendForbidden(String message) throws IOException; - - /** - * Set the accepted WebSocket Protocol. - * - * @param protocol - * the protocol to list as accepted - */ - public void setAcceptedSubProtocol(String protocol); - - /** - * Set the list of extensions that are approved for use with this websocket. - *

- * This is Advanced usage of the {@link WebSocketCreator} to allow for a custom set of negotiated extensions. - *

- * Notes: - *

    - *
  • Per the spec you cannot add extensions that have not been seen in the {@link UpgradeRequest}, just remove entries you don't want to use
  • - *
  • If this is unused, or a null is passed, then the list negotiation will follow default behavior and use the complete list of extensions that are - * available in this WebSocket server implementation.
  • - *
- * - * @param extensions - * the list of extensions to use. - */ - public void setExtensions(List extensions); - - public void setHeader(String name, String value); - - public void validateWebSocketHash(String expectedHash) throws UpgradeException; -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketAdapter.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketAdapter.java deleted file mode 100644 index a729024968e..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketAdapter.java +++ /dev/null @@ -1,83 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -import org.eclipse.jetty.websocket.core.api.io.WebSocketBlockingConnection; - -/** - * Default implementation of the {@link WebSocketListener}. - *

- * Convenient abstract class to base standard WebSocket implementations off of. - */ -public class WebSocketAdapter implements WebSocketListener -{ - private WebSocketConnection connection; - private WebSocketBlockingConnection blocking; - - public WebSocketBlockingConnection getBlockingConnection() - { - return blocking; - } - - public WebSocketConnection getConnection() - { - return connection; - } - - public boolean isConnected() - { - return (connection != null) && (connection.isOpen()); - } - - public boolean isNotConnected() - { - return (connection == null) || (!connection.isOpen()); - } - - @Override - public void onWebSocketBinary(byte[] payload, int offset, int len) - { - /* do nothing */ - } - - @Override - public void onWebSocketClose(int statusCode, String reason) - { - this.connection = null; - } - - @Override - public void onWebSocketConnect(WebSocketConnection connection) - { - this.connection = connection; - this.blocking = new WebSocketBlockingConnection(this.connection); - } - - @Override - public void onWebSocketException(WebSocketException error) - { - /* do nothing */ - } - - @Override - public void onWebSocketText(String message) - { - /* do nothing */ - } -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketBehavior.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketBehavior.java deleted file mode 100644 index 8d9e2742be5..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketBehavior.java +++ /dev/null @@ -1,31 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -/** - * Behavior for how the WebSocket should operate. - *

- * This dictated by the RFC 6455 spec in various places, where certain behavior must be performed depending on - * operation as a CLIENT vs a SERVER - */ -public enum WebSocketBehavior -{ - CLIENT, - SERVER; -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketConnection.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketConnection.java deleted file mode 100644 index 7fe32749b00..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketConnection.java +++ /dev/null @@ -1,75 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -import java.io.IOException; -import java.nio.ByteBuffer; - -import org.eclipse.jetty.util.Callback; - -/** - * Connection interface for WebSocket protocol RFC-6455. - */ -public interface WebSocketConnection extends LogicalConnection -{ - /** - * Access the (now read-only) {@link WebSocketPolicy} in use for this connection. - * - * @return the policy in use - */ - WebSocketPolicy getPolicy(); - - /** - * Get the SubProtocol in use for this connection. - * - * @return the negotiated sub protocol name in use for this connection, can be null if there is no sub-protocol negotiated. - */ - String getSubProtocol(); - - /** - * Send a single ping messages. - *

- * NIO style with callbacks, allows for knowledge of successful ping send. - *

- * Use @OnWebSocketFrame and monitor Pong frames - */ - void ping(C context, Callback callback, byte payload[]) throws IOException; - - /** - * Send a a binary message. - *

- * NIO style with callbacks, allows for concurrent results of the write operation. - */ - void write(C context, Callback callback, byte buf[], int offset, int len) throws IOException; - - /** - * Send a a binary message. - *

- * NIO style with callbacks, allows for concurrent results of the write operation. - */ - void write(C context, Callback callback, ByteBuffer buffer) throws IOException; - - /** - * Send a series of text messages. - *

- * NIO style with callbacks, allows for concurrent results of the entire write operation. (Callback is only called once at the end of processing all of the - * messages) - */ - void write(C context, Callback callback, String message) throws IOException; -} \ No newline at end of file diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketException.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketException.java deleted file mode 100644 index 9b458d7e5b3..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketException.java +++ /dev/null @@ -1,46 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -/** - * A recoverable exception within the websocket framework. - */ -@SuppressWarnings("serial") -public class WebSocketException extends RuntimeException -{ - public WebSocketException() - { - super(); - } - - public WebSocketException(String message) - { - super(message); - } - - public WebSocketException(String message, Throwable cause) - { - super(message,cause); - } - - public WebSocketException(Throwable cause) - { - super(cause); - } -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketListener.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketListener.java deleted file mode 100644 index b5a4ec79ceb..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketListener.java +++ /dev/null @@ -1,78 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - -/** - * Basic WebSocket Listener interface for incoming WebSocket events. - */ -public interface WebSocketListener -{ - /** - * A WebSocket binary frame has been received. - * - * @param payload the raw payload array received - * @param offset the offset in the payload array where the data starts - * @param len the length of bytes in the payload - */ - void onWebSocketBinary(byte payload[], int offset, int len); - - /** - * A Close Event was received. - *

- * The underlying {@link WebSocketConnection} will be considered closed at this point. - * - * @param statusCode - * the close status code. (See {@link StatusCode}) - * @param reason - * the optional reason for the close. - */ - void onWebSocketClose(int statusCode, String reason); - - /** - * A WebSocketConnection has connected successfully and is ready to be used. - *

- * Note: It is a good idea to track this connection as a field in your object so that you can write messages back. - * - * @param connection - * the connection to use to send messages on. - */ - void onWebSocketConnect(WebSocketConnection connection); - - /** - * A WebSocket exception has occurred. - *

- * Usually this occurs from bad / malformed incoming packets. (example: bad UTF8 data, frames that are too big, violations of the spec) - *

- * This will result in the {@link WebSocketConnection} being closed by the implementing side. - *

- * Note: you will receive no {@link #onWebSocketClose(int, String)} as this condition results in the API calling - * {@link WebSocketConnection#close(int, String)} for you. - * - * @param error - * the error that occurred. - */ - void onWebSocketException(WebSocketException error); - - /** - * A WebSocket Text frame was received. - * - * @param message - */ - void onWebSocketText(String message); -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketPolicy.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketPolicy.java deleted file mode 100644 index 584e44a21ea..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/WebSocketPolicy.java +++ /dev/null @@ -1,208 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api; - - -/** - * Settings for WebSocket operations. - */ -public class WebSocketPolicy -{ - public static WebSocketPolicy newClientPolicy() - { - return new WebSocketPolicy(WebSocketBehavior.CLIENT); - } - - public static WebSocketPolicy newServerPolicy() - { - return new WebSocketPolicy(WebSocketBehavior.SERVER); - } - - /** - * Automatically fragment large frames. - *

- * If frames are encountered at size larger than {@link #maxPayloadSize} then they are automatically fragmented into pieces fitting within the - * maxPayloadSize. - *

- * Default: false - */ - private boolean autoFragment = false; - - /** - * The maximum allowed payload size (validated in both directions) - *

- * Default: 65536 (64K) - */ - private int maxPayloadSize = 65536; - - /** - * The maximum size of a text message during parsing/generating. - *

- * Default: 16384 (16 K) - */ - private int maxTextMessageSize = 16384; - - /** - * The maximum size of a binary message during parsing/generating. - *

- * Default: -1 (no validation) - */ - private int maxBinaryMessageSize = -1; - - /** - * Maximum Message Buffer size, which is also the max frame byte size. - *

- * Default: 65536 (64 K) - */ - private int bufferSize = 65536; - - // TODO: change bufferSize to windowSize for FrameBytes logic? - - /** - * The time in ms (milliseconds) that a websocket may be idle before closing. - *

- * Default: 300000 (ms) - */ - private int idleTimeout = 300000; - - /** - * Behavior of the websockets - */ - private final WebSocketBehavior behavior; - - public WebSocketPolicy(WebSocketBehavior behavior) - { - this.behavior = behavior; - } - - public void assertValidBinaryMessageSize(int requestedSize) - { - if (maxBinaryMessageSize > 0) - { - // validate it - if (requestedSize > maxBinaryMessageSize) - { - throw new MessageTooLargeException("Requested binary message size [" + requestedSize + "] exceeds maximum size [" + maxBinaryMessageSize + "]"); - } - } - } - - public void assertValidPayloadLength(int payloadLength) - { - // validate to buffer sizes - if (payloadLength > maxPayloadSize) - { - throw new MessageTooLargeException("Requested payload length [" + payloadLength + "] exceeds maximum size [" + maxPayloadSize + "]"); - } - } - - public void assertValidTextMessageSize(int requestedSize) - { - if (maxTextMessageSize > 0) - { - // validate it - if (requestedSize > maxTextMessageSize) - { - throw new MessageTooLargeException("Requested text message size [" + requestedSize + "] exceeds maximum size [" + maxTextMessageSize + "]"); - } - } - } - - public WebSocketPolicy clonePolicy() - { - WebSocketPolicy clone = new WebSocketPolicy(this.behavior); - clone.autoFragment = this.autoFragment; - clone.idleTimeout = this.idleTimeout; - clone.bufferSize = this.bufferSize; - clone.maxPayloadSize = this.maxPayloadSize; - clone.maxBinaryMessageSize = this.maxBinaryMessageSize; - clone.maxTextMessageSize = this.maxTextMessageSize; - return clone; - } - - public WebSocketBehavior getBehavior() - { - return behavior; - } - - public int getBufferSize() - { - return bufferSize; - } - - public int getIdleTimeout() - { - return idleTimeout; - } - - public int getMaxBinaryMessageSize() - { - return maxBinaryMessageSize; - } - - public int getMaxPayloadSize() - { - return maxPayloadSize; - } - - public int getMaxTextMessageSize() - { - return maxTextMessageSize; - } - - public boolean isAutoFragment() - { - return autoFragment; - } - - public void setAutoFragment(boolean autoFragment) - { - this.autoFragment = autoFragment; - } - - public void setBufferSize(int bufferSize) - { - this.bufferSize = bufferSize; - } - - public void setIdleTimeout(int idleTimeout) - { - this.idleTimeout = idleTimeout; - } - - public void setMaxBinaryMessageSize(int maxBinaryMessageSize) - { - this.maxBinaryMessageSize = maxBinaryMessageSize; - } - - public void setMaxPayloadSize(int maxPayloadSize) - { - if (maxPayloadSize < bufferSize) - { - throw new IllegalStateException("Cannot have payload size be smaller than buffer size"); - } - this.maxPayloadSize = maxPayloadSize; - } - - public void setMaxTextMessageSize(int maxTextMessageSize) - { - this.maxTextMessageSize = maxTextMessageSize; - } - -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/io/WebSocketBlockingConnection.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/io/WebSocketBlockingConnection.java deleted file mode 100644 index 3fe0838d67c..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/io/WebSocketBlockingConnection.java +++ /dev/null @@ -1,122 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api.io; - -import java.io.IOException; -import java.util.concurrent.ExecutionException; - -import org.eclipse.jetty.util.FutureCallback; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.io.WebSocketSession; - -/** - * For working with the {@link WebSocketConnection} in a blocking technique. - *

- * This is an end-user accessible class. - */ -public class WebSocketBlockingConnection -{ - private static class Blocker extends FutureCallback - { - @Override - public void completed(String context) - { - LOG.debug("completed({})",context); - super.completed(context); - } - - @Override - public void failed(String context, Throwable cause) - { - LOG.debug("failed({},{})",context,cause); - super.failed(context,cause); - } - - @Override - public String toString() - { - return String.format("%s[%s]",Blocker.class.getSimpleName(),super.toString()); - } - } - - private static final Logger LOG = Log.getLogger(WebSocketBlockingConnection.class); - private static final String CONTEXT_BINARY = "BLOCKING_BINARY"; - private static final String CONTEXT_TEXT = "BLOCKING_TEXT"; - private final WebSocketSession conn; - - public WebSocketBlockingConnection(WebSocketConnection conn) - { - if (conn instanceof WebSocketSession) - { - this.conn = (WebSocketSession)conn; - } - else - { - throw new IllegalArgumentException("WebSocketConnection must implement internal WebSocketSession interface"); - } - } - - /** - * Send a binary message. - *

- * Basic usage, results in a blocking write. - */ - public void write(byte[] data, int offset, int length) throws IOException - { - try - { - Blocker blocker = new Blocker(); - conn.write(CONTEXT_BINARY,blocker,data,offset,length); - blocker.get(); // block till finished - } - catch (InterruptedException e) - { - throw new IOException("Blocking write failed",e); - } - catch (ExecutionException e) - { - FutureCallback.rethrow(e); - } - } - - /** - * Send text message. - *

- * Basic usage, results in a blocking write. - */ - public void write(String message) throws IOException - { - try - { - Blocker blocker = new Blocker(); - conn.write(CONTEXT_TEXT,blocker,message); - blocker.get(); // block till finished - } - catch (InterruptedException e) - { - throw new IOException("Blocking write failed",e); - } - catch (ExecutionException e) - { - FutureCallback.rethrow(e); - } - } -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/io/WebSocketOutputStream.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/io/WebSocketOutputStream.java deleted file mode 100644 index b39c7ac8fdc..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/io/WebSocketOutputStream.java +++ /dev/null @@ -1,50 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api.io; - -import java.io.IOException; -import java.io.OutputStream; - -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.io.WebSocketSession; - -public class WebSocketOutputStream extends OutputStream -{ - private final WebSocketSession conn; - - public WebSocketOutputStream(WebSocketConnection conn) - { - if (conn instanceof WebSocketSession) - { - this.conn = (WebSocketSession)conn; - } - else - { - throw new IllegalArgumentException("WebSocketConnection must implement internal WebSocketSession interface"); - } - } - - @Override - public void write(int b) throws IOException - { - // TODO Auto-generated method stub - - } - -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/io/WebSocketWriter.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/io/WebSocketWriter.java deleted file mode 100644 index c61fe6bc2a8..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/api/io/WebSocketWriter.java +++ /dev/null @@ -1,66 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.api.io; - -import java.io.IOException; -import java.io.Writer; -import java.nio.charset.Charset; - -import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.io.WebSocketSession; - -public class WebSocketWriter extends Writer -{ - private final Charset charset = StringUtil.__UTF8_CHARSET; - private final WebSocketSession conn; - - public WebSocketWriter(WebSocketConnection conn) - { - if (conn instanceof WebSocketSession) - { - this.conn = (WebSocketSession)conn; - } - else - { - throw new IllegalArgumentException("WebSocketConnection must implement internal WebSocketSession interface"); - } - } - - @Override - public void close() throws IOException - { - // TODO Auto-generated method stub - - } - - @Override - public void flush() throws IOException - { - // TODO Auto-generated method stub - - } - - @Override - public void write(char[] cbuf, int off, int len) throws IOException - { - // TODO Auto-generated method stub - - } -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/WebSocketExtensionRegistry.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/WebSocketExtensionRegistry.java deleted file mode 100644 index 48f1466e264..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/WebSocketExtensionRegistry.java +++ /dev/null @@ -1,126 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.extensions; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.eclipse.jetty.io.ByteBufferPool; -import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.websocket.core.api.Extension; -import org.eclipse.jetty.websocket.core.api.ExtensionRegistry; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.extensions.compress.PerMessageCompressionExtension; -import org.eclipse.jetty.websocket.core.extensions.compress.WebkitDeflateFrameExtension; -import org.eclipse.jetty.websocket.core.extensions.fragment.FragmentExtension; -import org.eclipse.jetty.websocket.core.extensions.identity.IdentityExtension; -import org.eclipse.jetty.websocket.core.protocol.ExtensionConfig; - -public class WebSocketExtensionRegistry implements ExtensionRegistry -{ - private Map> registry; - private WebSocketPolicy policy; - private ByteBufferPool bufferPool; - - public WebSocketExtensionRegistry(WebSocketPolicy policy, ByteBufferPool bufferPool) - { - this.policy = policy; - this.bufferPool = bufferPool; - - this.registry = new HashMap<>(); - - this.registry.put("identity",IdentityExtension.class); - this.registry.put("fragment",FragmentExtension.class); - this.registry.put("x-webkit-deflate-frame",WebkitDeflateFrameExtension.class); - this.registry.put("permessage-compress",PerMessageCompressionExtension.class); - } - - @Override - public boolean isAvailable(String name) - { - synchronized (registry) - { - return registry.containsKey(name); - } - } - - @Override - public Iterator> iterator() - { - List> coll = new ArrayList<>(); - synchronized (registry) - { - coll.addAll(registry.values()); - return coll.iterator(); - } - } - - public Extension newInstance(ExtensionConfig config) - { - if (config == null) - { - return null; - } - String name = config.getName(); - if (StringUtil.isBlank(name)) - { - return null; - } - Class extClass = registry.get(name); - if (extClass == null) - { - return null; - } - - try - { - Extension ext = extClass.newInstance(); - ext.setConfig(config); - ext.setPolicy(policy); - ext.setBufferPool(bufferPool); - return ext; - } - catch (InstantiationException | IllegalAccessException e) - { - throw new WebSocketException("Cannot instantiate extension: " + extClass,e); - } - } - - @Override - public void register(String name, Class extension) - { - synchronized (registry) - { - registry.put(name,extension); - } - } - - @Override - public void unregister(String name) - { - synchronized (registry) - { - registry.remove(name); - } - } -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/compress/PerMessageCompressionExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/compress/PerMessageCompressionExtension.java deleted file mode 100644 index e707928713a..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/compress/PerMessageCompressionExtension.java +++ /dev/null @@ -1,160 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.extensions.compress; - -import java.io.IOException; -import java.nio.ByteBuffer; - -import org.eclipse.jetty.util.Callback; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.Extension; -import org.eclipse.jetty.websocket.core.protocol.ExtensionConfig; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; - -/** - * Per Message Compression extension for WebSocket. - *

- * Attempts to follow draft-ietf-hybi-permessage-compression-01 - */ -public class PerMessageCompressionExtension extends Extension -{ - private static final Logger LOG = Log.getLogger(PerMessageCompressionExtension.class); - - private CompressionMethod method; - - @Override - public void incoming(final WebSocketFrame frame) - { - if (frame.isControlFrame() || !frame.isRsv1()) - { - // Cannot modify incoming control frames or ones with RSV1 set. - super.incoming(frame); - return; - } - - ByteBuffer data = frame.getPayload(); - try - { - method.decompress().input(data); - while (!method.decompress().isDone()) - { - ByteBuffer uncompressed = method.decompress().process(); - if (uncompressed == null) - { - continue; - } - WebSocketFrame out = new WebSocketFrame(frame,uncompressed); - if (!method.decompress().isDone()) - { - out.setFin(false); - } - nextIncoming(out); - } - - // reset only at the end of a message. - if (frame.isFin()) - { - method.decompress().end(); - } - } - finally - { - // release original buffer (no longer needed) - getBufferPool().release(data); - } - } - - /** - * Indicates use of RSV1 flag for indicating deflation is in use. - */ - @Override - public boolean isRsv1User() - { - return true; - } - - @Override - public boolean isTextDataDecoder() - { - // this extension is responsible for text data frames - return true; - } - - @Override - public void output(C context, Callback callback, final WebSocketFrame frame) throws IOException - { - if (frame.isControlFrame()) - { - // skip, cannot compress control frames. - nextOutput(context,callback,frame); - return; - } - - ByteBuffer data = frame.getPayload(); - try - { - // deflate data - method.compress().input(data); - while (!method.compress().isDone()) - { - ByteBuffer buf = method.compress().process(); - WebSocketFrame out = new WebSocketFrame(frame,buf); - out.setRsv1(true); - if (!method.compress().isDone()) - { - out.setFin(false); - nextOutputNoCallback(out); - } - else - { - nextOutput(context,callback,out); - } - } - - // reset only at end of message - if (frame.isFin()) - { - method.compress().end(); - } - } - finally - { - // free original data buffer - getBufferPool().release(data); - } - } - - @Override - public void setConfig(ExtensionConfig config) - { - super.setConfig(config); - - String methodOptions = config.getParameter("method","deflate"); - LOG.debug("Method requested: {}",methodOptions); - - method = new DeflateCompressionMethod(); - } - - @Override - public String toString() - { - return String.format("%s[method=%s]",this.getClass().getSimpleName(),method); - } -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/compress/WebkitDeflateFrameExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/compress/WebkitDeflateFrameExtension.java deleted file mode 100644 index 4a8fb55e121..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/compress/WebkitDeflateFrameExtension.java +++ /dev/null @@ -1,157 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.extensions.compress; - -import java.io.IOException; -import java.nio.ByteBuffer; - -import org.eclipse.jetty.util.Callback; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.Extension; -import org.eclipse.jetty.websocket.core.protocol.ExtensionConfig; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; - -/** - * Implementation of the x-webkit-deflate-frame extension seen out - * in the wild. - */ -public class WebkitDeflateFrameExtension extends Extension -{ - private static final Logger LOG = Log.getLogger(WebkitDeflateFrameExtension.class); - - private DeflateCompressionMethod method; - - @Override - public void incoming(WebSocketFrame frame) - { - if (frame.isControlFrame() || !frame.isRsv1()) - { - // Cannot modify incoming control frames or ones with RSV1 set. - super.incoming(frame); - return; - } - - LOG.debug("Decompressing Frame: {}",frame); - - ByteBuffer data = frame.getPayload(); - try - { - method.decompress().input(data); - while (!method.decompress().isDone()) - { - ByteBuffer uncompressed = method.decompress().process(); - WebSocketFrame out = new WebSocketFrame(frame,uncompressed); - if (!method.decompress().isDone()) - { - out.setFin(false); - } - nextIncoming(out); - } - - // reset on every frame. - method.decompress().end(); - } - finally - { - // release original buffer (no longer needed) - getBufferPool().release(data); - } - } - - /** - * Indicates use of RSV1 flag for indicating deflation is in use. - *

- * Also known as the "COMP" framing header bit - */ - @Override - public boolean isRsv1User() - { - return true; - } - - /** - * Indicate that this extensions is now responsible for TEXT Data Frame compliance to the WebSocket spec. - */ - @Override - public boolean isTextDataDecoder() - { - return true; - } - - @Override - public void output(C context, Callback callback, WebSocketFrame frame) throws IOException - { - if (frame.isControlFrame()) - { - // skip, cannot compress control frames. - nextOutput(context,callback,frame); - return; - } - - if (LOG.isDebugEnabled()) - { - LOG.debug("output({}, {}, {})",context,callback,frame); - } - - ByteBuffer data = frame.getPayload(); - try - { - // deflate data - method.compress().input(data); - while (!method.compress().isDone()) - { - ByteBuffer buf = method.compress().process(); - WebSocketFrame out = new WebSocketFrame(frame,buf); - out.setRsv1(true); - if (!method.compress().isDone()) - { - out.setFin(false); - nextOutputNoCallback(out); - } - else - { - nextOutput(context,callback,out); - } - } - - // reset on every frame. - method.compress().end(); - } - finally - { - // free original data buffer - getBufferPool().release(data); - } - } - - @Override - public void setConfig(ExtensionConfig config) - { - super.setConfig(config); - - method = new DeflateCompressionMethod(); - } - - @Override - public String toString() - { - return this.getClass().getSimpleName() + "[]"; - } -} \ No newline at end of file diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/fragment/FragmentExtension.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/fragment/FragmentExtension.java deleted file mode 100644 index 05ec0239eed..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/extensions/fragment/FragmentExtension.java +++ /dev/null @@ -1,98 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.extensions.fragment; - -import java.io.IOException; -import java.nio.ByteBuffer; - -import org.eclipse.jetty.util.Callback; -import org.eclipse.jetty.websocket.core.api.Extension; -import org.eclipse.jetty.websocket.core.protocol.ExtensionConfig; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; - -public class FragmentExtension extends Extension -{ - private int maxLength = -1; - - @Override - public void output(C context, Callback callback, final WebSocketFrame frame) throws IOException - { - if (frame.isControlFrame()) - { - // Cannot fragment Control Frames - nextOutput(context,callback,frame); - return; - } - - int length = frame.getPayloadLength(); - - byte opcode = frame.getOpCode(); // original opcode - ByteBuffer payload = frame.getPayload().slice(); - int originalLimit = payload.limit(); - int currentPosition = payload.position(); - - if (maxLength <= 0) - { - // output original frame - nextOutput(context,callback,frame); - return; - } - - boolean continuation = false; - - // break apart payload based on maxLength rules - while (length > maxLength) - { - WebSocketFrame frag = new WebSocketFrame(frame); - frag.setOpCode(opcode); - frag.setFin(false); // always false here - frag.setContinuation(continuation); - payload.position(currentPosition); - payload.limit(Math.min(payload.position() + maxLength,originalLimit)); - frag.setPayload(payload); - - nextOutputNoCallback(frag); - - length -= maxLength; - opcode = OpCode.CONTINUATION; - continuation = true; - currentPosition = payload.limit(); - } - - // write remaining - WebSocketFrame frag = new WebSocketFrame(frame); - frag.setOpCode(opcode); - frag.setFin(frame.isFin()); // use original fin - frag.setContinuation(continuation); - payload.position(currentPosition); - payload.limit(originalLimit); - frag.setPayload(payload); - - nextOutput(context,callback,frag); - } - - @Override - public void setConfig(ExtensionConfig config) - { - super.setConfig(config); - - maxLength = config.getParameter("maxLength",maxLength); - } -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/FramePipes.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/FramePipes.java deleted file mode 100644 index 9b51361908f..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/io/FramePipes.java +++ /dev/null @@ -1,90 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.io; - -import java.io.IOException; - -import org.eclipse.jetty.util.Callback; -import org.eclipse.jetty.util.FutureCallback; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; - -/** - * Utility class to pipe {@link IncomingFrames} and {@link OutgoingFrames} around - */ -public class FramePipes -{ - private static class In2Out implements IncomingFrames - { - private static final Logger LOG = Log.getLogger(In2Out.class); - private OutgoingFrames outgoing; - - public In2Out(OutgoingFrames outgoing) - { - this.outgoing = outgoing; - } - - @Override - public void incoming(WebSocketException e) - { - /* cannot send exception on */ - } - - @Override - public void incoming(WebSocketFrame frame) - { - try - { - this.outgoing.output(null,new FutureCallback<>(),frame); - } - catch (IOException e) - { - LOG.debug(e); - } - } - } - - private static class Out2In implements OutgoingFrames - { - private IncomingFrames incoming; - - public Out2In(IncomingFrames incoming) - { - this.incoming = incoming; - } - - @Override - public void output(C context, Callback callback, WebSocketFrame frame) throws IOException - { - this.incoming.incoming(frame); - } - } - - public static OutgoingFrames to(final IncomingFrames incoming) - { - return new Out2In(incoming); - } - - public static IncomingFrames to(final OutgoingFrames outgoing) - { - return new In2Out(outgoing); - } -} diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/Frame.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/Frame.java deleted file mode 100644 index 9904b1f0633..00000000000 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/core/protocol/Frame.java +++ /dev/null @@ -1,47 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2012 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - -package org.eclipse.jetty.websocket.core.protocol; - -import java.nio.ByteBuffer; - -/** - * The immutable frame details. - *

- * Used by end user via @OnWebSocketFrame - */ -public interface Frame -{ - public byte[] getMask(); - - public byte getOpCode(); - - public ByteBuffer getPayload(); - - public int getPayloadLength(); - - public boolean isFin(); - - public boolean isMasked(); - - public boolean isRsv1(); - - public boolean isRsv2(); - - public boolean isRsv3(); -} diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/GeneratorParserRoundtripTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/GeneratorParserRoundtripTest.java index 0fd776a693f..6e793589d42 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/GeneratorParserRoundtripTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/GeneratorParserRoundtripTest.java @@ -26,12 +26,12 @@ import java.util.Arrays; import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.MappedByteBufferPool; import org.eclipse.jetty.util.BufferUtil; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.Generator; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.Generator; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.Parser; +import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.core.protocol.IncomingFramesCapture; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.Parser; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase1_1.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase1_1.java index d5f22c0443e..9d13fe72180 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase1_1.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase1_1.java @@ -20,15 +20,15 @@ package org.eclipse.jetty.websocket.core.ab; import java.nio.ByteBuffer; +import org.eclipse.jetty.websocket.api.WebSocketBehavior; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.Generator; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.Parser; +import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.core.ByteBufferAssert; -import org.eclipse.jetty.websocket.core.api.WebSocketBehavior; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.Generator; import org.eclipse.jetty.websocket.core.protocol.IncomingFramesCapture; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.Parser; import org.eclipse.jetty.websocket.core.protocol.UnitGenerator; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase1_2.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase1_2.java index a2665f2ef17..01e22ab9089 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase1_2.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase1_2.java @@ -21,15 +21,15 @@ package org.eclipse.jetty.websocket.core.ab; import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; +import org.eclipse.jetty.websocket.api.WebSocketBehavior; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.Generator; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.Parser; +import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.core.ByteBufferAssert; -import org.eclipse.jetty.websocket.core.api.WebSocketBehavior; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.Generator; import org.eclipse.jetty.websocket.core.protocol.IncomingFramesCapture; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.Parser; import org.eclipse.jetty.websocket.core.protocol.UnitGenerator; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase2.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase2.java index 408296704ac..afdbc07a22c 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase2.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase2.java @@ -21,17 +21,17 @@ package org.eclipse.jetty.websocket.core.ab; import java.nio.ByteBuffer; import java.util.Arrays; +import org.eclipse.jetty.websocket.api.ProtocolException; +import org.eclipse.jetty.websocket.api.WebSocketBehavior; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.Generator; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.Parser; +import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.core.ByteBufferAssert; -import org.eclipse.jetty.websocket.core.api.ProtocolException; -import org.eclipse.jetty.websocket.core.api.WebSocketBehavior; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.Generator; import org.eclipse.jetty.websocket.core.protocol.IncomingFramesCapture; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.Parser; import org.eclipse.jetty.websocket.core.protocol.UnitGenerator; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase3.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase3.java index 6973338490d..2f50129ace9 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase3.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase3.java @@ -23,11 +23,11 @@ import java.util.Collection; import java.util.List; import org.eclipse.jetty.toolchain.test.TestTracker; -import org.eclipse.jetty.websocket.core.api.ProtocolException; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.Generator; +import org.eclipse.jetty.websocket.api.ProtocolException; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.Generator; +import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.core.protocol.UnitGenerator; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase4.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase4.java index d0f3866848f..f8abb492792 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase4.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase4.java @@ -21,11 +21,11 @@ package org.eclipse.jetty.websocket.core.ab; import java.nio.ByteBuffer; import org.eclipse.jetty.util.log.StdErrLog; -import org.eclipse.jetty.websocket.core.api.WebSocketBehavior; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.WebSocketBehavior; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.Parser; import org.eclipse.jetty.websocket.core.protocol.IncomingFramesCapture; -import org.eclipse.jetty.websocket.core.protocol.Parser; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase7_3.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase7_3.java index 6ae4e908de1..14e1b2ecb5c 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase7_3.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/ab/TestABCase7_3.java @@ -23,17 +23,17 @@ import java.util.Arrays; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.StringUtil; +import org.eclipse.jetty.websocket.api.ProtocolException; +import org.eclipse.jetty.websocket.api.WebSocketBehavior; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.Generator; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.Parser; +import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.core.ByteBufferAssert; -import org.eclipse.jetty.websocket.core.api.ProtocolException; -import org.eclipse.jetty.websocket.core.api.WebSocketBehavior; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.Generator; import org.eclipse.jetty.websocket.core.protocol.IncomingFramesCapture; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.Parser; import org.eclipse.jetty.websocket.core.protocol.UnitGenerator; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadBinarySignatureSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadBinarySignatureSocket.java index fc9c43cbe4e..5386b246e50 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadBinarySignatureSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadBinarySignatureSocket.java @@ -18,9 +18,9 @@ package org.eclipse.jetty.websocket.core.annotations; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; /** * Invalid Socket: Annotate a message interest on a method with a return type. diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadDuplicateBinarySocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadDuplicateBinarySocket.java index b8d45886584..f70dc2ce0c6 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadDuplicateBinarySocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadDuplicateBinarySocket.java @@ -20,8 +20,8 @@ package org.eclipse.jetty.websocket.core.annotations; import java.io.InputStream; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; /** * Invalid Socket: Annotate 2 methods with interest in Binary Messages. diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadDuplicateFrameSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadDuplicateFrameSocket.java index f7cf6accd85..f20a631412a 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadDuplicateFrameSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadDuplicateFrameSocket.java @@ -18,9 +18,9 @@ package org.eclipse.jetty.websocket.core.annotations; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketFrame; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.protocol.Frame; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketFrame; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; +import org.eclipse.jetty.websocket.api.extensions.Frame; @WebSocket public class BadDuplicateFrameSocket diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadTextSignatureSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadTextSignatureSocket.java index 2b91d98e59c..1b55a77dc88 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadTextSignatureSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/BadTextSignatureSocket.java @@ -18,9 +18,9 @@ package org.eclipse.jetty.websocket.core.annotations; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; /** * Invalid Socket: Annotate a message interest on a static method diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/FrameSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/FrameSocket.java index 45795e62e68..54f4cb8ba55 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/FrameSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/FrameSocket.java @@ -18,9 +18,9 @@ package org.eclipse.jetty.websocket.core.annotations; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketFrame; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.protocol.Frame; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketFrame; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; +import org.eclipse.jetty.websocket.api.extensions.Frame; @WebSocket public class FrameSocket diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/MyEchoBinarySocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/MyEchoBinarySocket.java index 0f6bbf6abf4..baedae9bbd5 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/MyEchoBinarySocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/MyEchoBinarySocket.java @@ -20,8 +20,8 @@ package org.eclipse.jetty.websocket.core.annotations; import java.io.IOException; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; /** * Test of constructing a new WebSocket based on a base class diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/MyEchoSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/MyEchoSocket.java index e51247a3683..352261424b8 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/MyEchoSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/MyEchoSocket.java @@ -20,12 +20,12 @@ package org.eclipse.jetty.websocket.core.annotations; import java.io.IOException; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketClose; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketConnect; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.api.io.WebSocketBlockingConnection; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; +import org.eclipse.jetty.websocket.api.io.WebSocketBlockingConnection; /** * The most common websocket implementation. diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/MyStatelessEchoSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/MyStatelessEchoSocket.java index 336ae5a6d2b..3be8eff2fbd 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/MyStatelessEchoSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/MyStatelessEchoSocket.java @@ -21,9 +21,9 @@ package org.eclipse.jetty.websocket.core.annotations; import java.io.IOException; import org.eclipse.jetty.util.FutureCallback; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; /** * Example of a stateless websocket implementation. diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/NoopSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/NoopSocket.java index 719fcadb507..33ae738a0e7 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/NoopSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/NoopSocket.java @@ -18,7 +18,7 @@ package org.eclipse.jetty.websocket.core.annotations; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; /** * The most basic websocket declaration. diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/NotASocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/NotASocket.java index 203196eae57..d2d48b0d978 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/NotASocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/annotations/NotASocket.java @@ -18,8 +18,8 @@ package org.eclipse.jetty.websocket.core.annotations; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketConnect; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; /** * (Test Case) diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AdapterConnectCloseSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AdapterConnectCloseSocket.java index 7ea21291c91..6fd612a0094 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AdapterConnectCloseSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AdapterConnectCloseSocket.java @@ -18,8 +18,8 @@ package org.eclipse.jetty.websocket.core.examples; -import org.eclipse.jetty.websocket.core.api.WebSocketAdapter; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketAdapter; +import org.eclipse.jetty.websocket.api.WebSocketConnection; import org.eclipse.jetty.websocket.core.io.event.EventCapture; public class AdapterConnectCloseSocket extends WebSocketAdapter diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedBinaryArraySocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedBinaryArraySocket.java index 598b5440acb..cced4286b6e 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedBinaryArraySocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedBinaryArraySocket.java @@ -18,11 +18,11 @@ package org.eclipse.jetty.websocket.core.examples; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketClose; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketConnect; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; import org.eclipse.jetty.websocket.core.io.event.EventCapture; @WebSocket diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedBinaryStreamSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedBinaryStreamSocket.java index 7d52fceb378..e55ee4c97dd 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedBinaryStreamSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedBinaryStreamSocket.java @@ -20,11 +20,11 @@ package org.eclipse.jetty.websocket.core.examples; import java.io.InputStream; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketClose; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketConnect; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; import org.eclipse.jetty.websocket.core.io.event.EventCapture; @WebSocket diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedFramesSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedFramesSocket.java index 807be7c3674..aec9a415aaa 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedFramesSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedFramesSocket.java @@ -18,13 +18,13 @@ package org.eclipse.jetty.websocket.core.examples; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketClose; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketConnect; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketFrame; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketFrame; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; +import org.eclipse.jetty.websocket.api.extensions.Frame; import org.eclipse.jetty.websocket.core.io.event.EventCapture; -import org.eclipse.jetty.websocket.core.protocol.Frame; @WebSocket public class AnnotatedFramesSocket diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedStreamingSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedStreamingSocket.java index a54ad889dcd..0b38053280e 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedStreamingSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedStreamingSocket.java @@ -21,14 +21,14 @@ package org.eclipse.jetty.websocket.core.examples; import java.io.InputStream; import java.io.Reader; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketClose; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketConnect; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketFrame; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketFrame; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; +import org.eclipse.jetty.websocket.api.extensions.Frame; import org.eclipse.jetty.websocket.core.io.event.EventCapture; -import org.eclipse.jetty.websocket.core.protocol.Frame; @WebSocket public class AnnotatedStreamingSocket diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedTextSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedTextSocket.java index f3c01b0272e..9461a836a65 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedTextSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedTextSocket.java @@ -18,11 +18,11 @@ package org.eclipse.jetty.websocket.core.examples; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketClose; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketConnect; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; import org.eclipse.jetty.websocket.core.io.event.EventCapture; @WebSocket diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedTextStreamSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedTextStreamSocket.java index e7a95966b19..718e3a574f5 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedTextStreamSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/AnnotatedTextStreamSocket.java @@ -20,11 +20,11 @@ package org.eclipse.jetty.websocket.core.examples; import java.io.Reader; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketClose; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketConnect; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; import org.eclipse.jetty.websocket.core.io.event.EventCapture; @WebSocket diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/ListenerBasicSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/ListenerBasicSocket.java index 1a770871cb9..b43dc431999 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/ListenerBasicSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/ListenerBasicSocket.java @@ -18,9 +18,9 @@ package org.eclipse.jetty.websocket.core.examples; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketListener; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketListener; import org.eclipse.jetty.websocket.core.io.event.EventCapture; public class ListenerBasicSocket implements WebSocketListener diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/echo/AdapterEchoSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/echo/AdapterEchoSocket.java index 8981f653e0c..085c78c5155 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/echo/AdapterEchoSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/echo/AdapterEchoSocket.java @@ -22,7 +22,7 @@ import java.io.IOException; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.WebSocketAdapter; +import org.eclipse.jetty.websocket.api.WebSocketAdapter; /** * Example EchoSocket using Adapter. diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/echo/AnnotatedEchoSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/echo/AnnotatedEchoSocket.java index c96483fe191..15031f79045 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/echo/AnnotatedEchoSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/echo/AnnotatedEchoSocket.java @@ -21,9 +21,9 @@ package org.eclipse.jetty.websocket.core.examples.echo; import java.io.IOException; import org.eclipse.jetty.util.FutureCallback; -import org.eclipse.jetty.websocket.core.annotations.OnWebSocketMessage; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; /** * Example EchoSocket using Annotations. diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/echo/ListenerEchoSocket.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/echo/ListenerEchoSocket.java index a5d44e41c99..cc5bcb8d595 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/echo/ListenerEchoSocket.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/examples/echo/ListenerEchoSocket.java @@ -24,9 +24,9 @@ import java.util.logging.Logger; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.FutureCallback; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketListener; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketListener; /** * Example EchoSocket using Listener. diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/FragmentExtensionTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/FragmentExtensionTest.java index 5346b47a938..81e48043e96 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/FragmentExtensionTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/FragmentExtensionTest.java @@ -29,14 +29,15 @@ import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.FutureCallback; import org.eclipse.jetty.util.StringUtil; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.RequestedExtensionConfig; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.fragment.FragmentExtension; import org.eclipse.jetty.websocket.core.ByteBufferAssert; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.extensions.fragment.FragmentExtension; -import org.eclipse.jetty.websocket.core.protocol.ExtensionConfig; import org.eclipse.jetty.websocket.core.protocol.IncomingFramesCapture; -import org.eclipse.jetty.websocket.core.protocol.OpCode; import org.eclipse.jetty.websocket.core.protocol.OutgoingFramesCapture; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.eclipse.jetty.websocket.core.protocol.OutgoingFramesCapture.Write; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/IdentityExtensionTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/IdentityExtensionTest.java index 02983b17d77..54847fd1c13 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/IdentityExtensionTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/IdentityExtensionTest.java @@ -24,13 +24,14 @@ import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.FutureCallback; import org.eclipse.jetty.util.StringUtil; +import org.eclipse.jetty.websocket.api.extensions.Extension; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.AbstractExtension; +import org.eclipse.jetty.websocket.common.extensions.identity.IdentityExtension; import org.eclipse.jetty.websocket.core.ByteBufferAssert; -import org.eclipse.jetty.websocket.core.api.Extension; -import org.eclipse.jetty.websocket.core.extensions.identity.IdentityExtension; import org.eclipse.jetty.websocket.core.protocol.IncomingFramesCapture; -import org.eclipse.jetty.websocket.core.protocol.OpCode; import org.eclipse.jetty.websocket.core.protocol.OutgoingFramesCapture; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.eclipse.jetty.websocket.core.protocol.OutgoingFramesCapture.Write; import org.junit.Assert; import org.junit.Test; @@ -47,7 +48,7 @@ public class IdentityExtensionTest { IncomingFramesCapture capture = new IncomingFramesCapture(); - Extension ext = new IdentityExtension(); + AbstractExtension ext = new IdentityExtension(); ext.setNextIncomingFrames(capture); WebSocketFrame frame = WebSocketFrame.text("hello"); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/compress/DeflateCompressionMethodTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/compress/DeflateCompressionMethodTest.java index b7a2c6ec880..6485f54382d 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/compress/DeflateCompressionMethodTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/compress/DeflateCompressionMethodTest.java @@ -28,6 +28,8 @@ import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.common.extensions.compress.CompressionMethod; +import org.eclipse.jetty.websocket.common.extensions.compress.DeflateCompressionMethod; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/compress/PerMessageCompressionExtensionTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/compress/PerMessageCompressionExtensionTest.java index 90229d37288..75d1d7bdec8 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/compress/PerMessageCompressionExtensionTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/compress/PerMessageCompressionExtensionTest.java @@ -32,14 +32,16 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.FutureCallback; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.TypeUtil; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.RequestedExtensionConfig; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.compress.PerMessageCompressionExtension; import org.eclipse.jetty.websocket.core.ByteBufferAssert; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.ExtensionConfig; import org.eclipse.jetty.websocket.core.protocol.IncomingFramesCapture; -import org.eclipse.jetty.websocket.core.protocol.OpCode; import org.eclipse.jetty.websocket.core.protocol.OutgoingFramesCapture; import org.eclipse.jetty.websocket.core.protocol.OutgoingFramesCapture.Write; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/compress/WebkitDeflateFrameExtensionTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/compress/WebkitDeflateFrameExtensionTest.java index 2e988854e7c..cc616411dff 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/compress/WebkitDeflateFrameExtensionTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/compress/WebkitDeflateFrameExtensionTest.java @@ -32,16 +32,17 @@ import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.FutureCallback; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.TypeUtil; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig; +import org.eclipse.jetty.websocket.common.Generator; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.Parser; +import org.eclipse.jetty.websocket.common.RequestedExtensionConfig; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.compress.WebkitDeflateFrameExtension; import org.eclipse.jetty.websocket.core.ByteBufferAssert; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.extensions.compress.WebkitDeflateFrameExtension; -import org.eclipse.jetty.websocket.core.protocol.ExtensionConfig; -import org.eclipse.jetty.websocket.core.protocol.Generator; import org.eclipse.jetty.websocket.core.protocol.IncomingFramesCapture; -import org.eclipse.jetty.websocket.core.protocol.OpCode; import org.eclipse.jetty.websocket.core.protocol.OutgoingNetworkBytesCapture; -import org.eclipse.jetty.websocket.core.protocol.Parser; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxDecoder.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxDecoder.java index 83d1716b4bf..921ce21fa9f 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxDecoder.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxDecoder.java @@ -21,8 +21,9 @@ package org.eclipse.jetty.websocket.core.extensions.mux; import java.io.IOException; import org.eclipse.jetty.util.Callback; -import org.eclipse.jetty.websocket.core.io.OutgoingFrames; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxParser; +import org.eclipse.jetty.websocket.common.io.OutgoingFrames; /** * Helpful utility class to parse arbitrary mux events from a physical connection's OutgoingFrames. diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxEncoder.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxEncoder.java index bf7480d9312..3f0a8b031b3 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxEncoder.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxEncoder.java @@ -20,10 +20,12 @@ package org.eclipse.jetty.websocket.core.extensions.mux; import java.io.IOException; -import org.eclipse.jetty.websocket.core.io.FramePipes; -import org.eclipse.jetty.websocket.core.io.IncomingFrames; -import org.eclipse.jetty.websocket.core.io.OutgoingFrames; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxControlBlock; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxGenerator; +import org.eclipse.jetty.websocket.common.io.FramePipes; +import org.eclipse.jetty.websocket.common.io.IncomingFrames; +import org.eclipse.jetty.websocket.common.io.OutgoingFrames; /** * Helpful utility class to send arbitrary mux events into a physical connection's IncomingFrames. diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxEventCapture.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxEventCapture.java index 6c3cf12a71d..de4a9afc0d6 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxEventCapture.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxEventCapture.java @@ -24,12 +24,16 @@ import java.util.LinkedList; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelRequest; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelResponse; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxDropChannel; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxFlowControl; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxNewChannelSlot; -import org.eclipse.jetty.websocket.core.protocol.OpCode; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxControlBlock; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxException; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxParser; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxedFrame; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelRequest; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxDropChannel; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxFlowControl; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxNewChannelSlot; import org.junit.Assert; public class MuxEventCapture implements MuxParser.Listener diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxGeneratorWrite139SizeTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxGeneratorWrite139SizeTest.java index 281996167b1..ba927b4f7db 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxGeneratorWrite139SizeTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxGeneratorWrite139SizeTest.java @@ -27,6 +27,7 @@ import java.util.List; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.TypeUtil; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxGenerator; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxGeneratorWriteChannelIdTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxGeneratorWriteChannelIdTest.java index f6f10bd2f2b..464cf1a0484 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxGeneratorWriteChannelIdTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxGeneratorWriteChannelIdTest.java @@ -27,6 +27,7 @@ import java.util.List; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.TypeUtil; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxGenerator; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserRFCTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserRFCTest.java index 8042406d0b6..2c7dfe397ca 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserRFCTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserRFCTest.java @@ -31,12 +31,16 @@ import java.util.regex.Pattern; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.TypeUtil; -import org.eclipse.jetty.websocket.core.api.Extension; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.Parser; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.AbstractExtension; +import org.eclipse.jetty.websocket.common.extensions.mux.AbstractMuxExtension; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxParser; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxedFrame; +import org.eclipse.jetty.websocket.common.extensions.mux.Muxer; import org.eclipse.jetty.websocket.core.protocol.IncomingFramesCapture; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.Parser; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.Assert; import org.junit.Test; @@ -57,7 +61,7 @@ public class MuxParserRFCTest WebSocketPolicy policy = WebSocketPolicy.newServerPolicy(); Parser parser = new Parser(policy); parser.setIncomingFramesHandler(capture); - List muxList = Collections.singletonList(new DummyMuxExtension()); + List muxList = Collections.singletonList(new DummyMuxExtension()); parser.configureFromExtensions(muxList); ByteBuffer bbuf = ByteBuffer.wrap(buf); parser.parse(bbuf); diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserRead139Size_BadEncodingTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserRead139Size_BadEncodingTest.java index cfcf1e89fa6..dfddd51df2f 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserRead139Size_BadEncodingTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserRead139Size_BadEncodingTest.java @@ -26,6 +26,8 @@ import java.util.Collection; import java.util.List; import org.eclipse.jetty.util.TypeUtil; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxException; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxParser; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserRead139Size_GoodTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserRead139Size_GoodTest.java index b0a0b44932f..6efd5e5b255 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserRead139Size_GoodTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserRead139Size_GoodTest.java @@ -26,6 +26,7 @@ import java.util.Collection; import java.util.List; import org.eclipse.jetty.util.TypeUtil; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxParser; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserReadChannelId_BadEncodingTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserReadChannelId_BadEncodingTest.java index 22fd4dfb738..2d3fee5935e 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserReadChannelId_BadEncodingTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserReadChannelId_BadEncodingTest.java @@ -26,6 +26,8 @@ import java.util.Collection; import java.util.List; import org.eclipse.jetty.util.TypeUtil; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxException; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxParser; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserReadChannelId_GoodTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserReadChannelId_GoodTest.java index d8b2b82461e..826135ee07f 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserReadChannelId_GoodTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/MuxParserReadChannelId_GoodTest.java @@ -26,6 +26,7 @@ import java.util.Collection; import java.util.List; import org.eclipse.jetty.util.TypeUtil; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxParser; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/DummyMuxAddClient.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/DummyMuxAddClient.java index 96d68e77e5d..a9e2cc9fcfb 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/DummyMuxAddClient.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/DummyMuxAddClient.java @@ -18,8 +18,9 @@ package org.eclipse.jetty.websocket.core.extensions.mux.add; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelResponse; -import org.eclipse.jetty.websocket.core.io.WebSocketSession; +import org.eclipse.jetty.websocket.common.extensions.mux.add.MuxAddClient; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.common.io.WebSocketSession; public class DummyMuxAddClient implements MuxAddClient { diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/DummyMuxAddServer.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/DummyMuxAddServer.java index ad756a5efac..4e4f6d9c352 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/DummyMuxAddServer.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/DummyMuxAddServer.java @@ -22,17 +22,18 @@ import java.io.IOException; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.UpgradeRequest; -import org.eclipse.jetty.websocket.core.api.UpgradeResponse; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.UpgradeRequest; +import org.eclipse.jetty.websocket.api.UpgradeResponse; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxChannel; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxException; +import org.eclipse.jetty.websocket.common.extensions.mux.Muxer; +import org.eclipse.jetty.websocket.common.extensions.mux.add.MuxAddServer; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.common.io.WebSocketSession; +import org.eclipse.jetty.websocket.common.io.event.EventDriver; +import org.eclipse.jetty.websocket.common.io.event.EventDriverFactory; import org.eclipse.jetty.websocket.core.examples.echo.AdapterEchoSocket; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxChannel; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxException; -import org.eclipse.jetty.websocket.core.extensions.mux.Muxer; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelResponse; -import org.eclipse.jetty.websocket.core.io.WebSocketSession; -import org.eclipse.jetty.websocket.core.io.event.EventDriver; -import org.eclipse.jetty.websocket.core.io.event.EventDriverFactory; /** * Dummy impl of MuxAddServer diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/MuxerAddClientTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/MuxerAddClientTest.java index 127975fe891..f1b011045be 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/MuxerAddClientTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/MuxerAddClientTest.java @@ -18,14 +18,14 @@ package org.eclipse.jetty.websocket.core.extensions.mux.add; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxChannel; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxChannel; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxOp; +import org.eclipse.jetty.websocket.common.extensions.mux.Muxer; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelRequest; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; import org.eclipse.jetty.websocket.core.extensions.mux.MuxDecoder; import org.eclipse.jetty.websocket.core.extensions.mux.MuxEncoder; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxOp; -import org.eclipse.jetty.websocket.core.extensions.mux.Muxer; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelRequest; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelResponse; import org.eclipse.jetty.websocket.core.io.LocalWebSocketConnection; import org.junit.Ignore; import org.junit.Rule; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/MuxerAddServerTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/MuxerAddServerTest.java index f23bef5bb35..9ca984ee1d0 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/MuxerAddServerTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/extensions/mux/add/MuxerAddServerTest.java @@ -20,16 +20,16 @@ package org.eclipse.jetty.websocket.core.extensions.mux.add; import static org.hamcrest.Matchers.*; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.extensions.mux.MuxOp; +import org.eclipse.jetty.websocket.common.extensions.mux.Muxer; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelRequest; +import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; import org.eclipse.jetty.websocket.core.extensions.mux.MuxDecoder; import org.eclipse.jetty.websocket.core.extensions.mux.MuxEncoder; -import org.eclipse.jetty.websocket.core.extensions.mux.MuxOp; -import org.eclipse.jetty.websocket.core.extensions.mux.Muxer; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelRequest; -import org.eclipse.jetty.websocket.core.extensions.mux.op.MuxAddChannelResponse; import org.eclipse.jetty.websocket.core.io.LocalWebSocketConnection; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.Assert; import org.junit.Ignore; import org.junit.Rule; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/LocalWebSocketConnection.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/LocalWebSocketConnection.java index 3a37a17726c..dd9cf6fce4a 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/LocalWebSocketConnection.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/LocalWebSocketConnection.java @@ -23,13 +23,14 @@ import java.net.InetSocketAddress; import java.nio.ByteBuffer; import org.eclipse.jetty.util.Callback; -import org.eclipse.jetty.websocket.core.api.SuspendToken; -import org.eclipse.jetty.websocket.core.api.WebSocketConnection; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.ConnectionState; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.SuspendToken; +import org.eclipse.jetty.websocket.api.WebSocketConnection; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.ConnectionState; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.io.IncomingFrames; import org.junit.rules.TestName; public class LocalWebSocketConnection implements WebSocketConnection, IncomingFrames diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/LocalWebSocketSession.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/LocalWebSocketSession.java index 0b02b4c1337..fda609f1a42 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/LocalWebSocketSession.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/LocalWebSocketSession.java @@ -18,8 +18,9 @@ package org.eclipse.jetty.websocket.core.io; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.io.event.EventDriver; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.io.WebSocketSession; +import org.eclipse.jetty.websocket.common.io.event.EventDriver; import org.eclipse.jetty.websocket.core.protocol.OutgoingFramesCapture; import org.junit.rules.TestName; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/event/EventDriverFactoryTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/event/EventDriverFactoryTest.java index d9966adb10c..f08be945ab5 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/event/EventDriverFactoryTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/event/EventDriverFactoryTest.java @@ -20,6 +20,15 @@ package org.eclipse.jetty.websocket.core.io.event; import static org.hamcrest.Matchers.*; +import org.eclipse.jetty.websocket.api.InvalidWebSocketException; +import org.eclipse.jetty.websocket.api.WebSocketListener; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.annotations.WebSocket; +import org.eclipse.jetty.websocket.common.io.event.EventDriver; +import org.eclipse.jetty.websocket.common.io.event.EventDriverFactory; +import org.eclipse.jetty.websocket.common.io.event.EventMethod; +import org.eclipse.jetty.websocket.common.io.event.EventMethods; +import org.eclipse.jetty.websocket.common.io.event.ListenerEventDriver; import org.eclipse.jetty.websocket.core.annotations.BadBinarySignatureSocket; import org.eclipse.jetty.websocket.core.annotations.BadDuplicateBinarySocket; import org.eclipse.jetty.websocket.core.annotations.BadDuplicateFrameSocket; @@ -30,10 +39,6 @@ import org.eclipse.jetty.websocket.core.annotations.MyEchoSocket; import org.eclipse.jetty.websocket.core.annotations.MyStatelessEchoSocket; import org.eclipse.jetty.websocket.core.annotations.NoopSocket; import org.eclipse.jetty.websocket.core.annotations.NotASocket; -import org.eclipse.jetty.websocket.core.annotations.WebSocket; -import org.eclipse.jetty.websocket.core.api.InvalidWebSocketException; -import org.eclipse.jetty.websocket.core.api.WebSocketListener; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; import org.eclipse.jetty.websocket.core.examples.AdapterConnectCloseSocket; import org.eclipse.jetty.websocket.core.examples.AnnotatedBinaryArraySocket; import org.eclipse.jetty.websocket.core.examples.AnnotatedBinaryStreamSocket; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/event/EventDriverTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/event/EventDriverTest.java index bd2c40246ef..6d1138ce9ce 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/event/EventDriverTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/event/EventDriverTest.java @@ -18,17 +18,19 @@ package org.eclipse.jetty.websocket.core.io.event; -import org.eclipse.jetty.websocket.core.api.StatusCode; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.StatusCode; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.io.event.EventDriver; +import org.eclipse.jetty.websocket.common.io.event.EventDriverFactory; import org.eclipse.jetty.websocket.core.examples.AdapterConnectCloseSocket; import org.eclipse.jetty.websocket.core.examples.AnnotatedBinaryArraySocket; import org.eclipse.jetty.websocket.core.examples.AnnotatedBinaryStreamSocket; import org.eclipse.jetty.websocket.core.examples.AnnotatedFramesSocket; import org.eclipse.jetty.websocket.core.examples.ListenerBasicSocket; import org.eclipse.jetty.websocket.core.io.LocalWebSocketSession; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/payload/DeMaskProcessorTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/payload/DeMaskProcessorTest.java index 33715514583..dbe303313d2 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/payload/DeMaskProcessorTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/payload/DeMaskProcessorTest.java @@ -24,10 +24,10 @@ import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.TypeUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.io.payload.DeMaskProcessor; import org.eclipse.jetty.websocket.core.ByteBufferAssert; -import org.eclipse.jetty.websocket.core.io.payload.DeMaskProcessor; import org.eclipse.jetty.websocket.core.protocol.UnitGenerator; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.Test; public class DeMaskProcessorTest diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/payload/UTF8ValidatorTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/payload/UTF8ValidatorTest.java index 2a4f9aeaf20..7d2c199cbfe 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/payload/UTF8ValidatorTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/io/payload/UTF8ValidatorTest.java @@ -21,8 +21,8 @@ package org.eclipse.jetty.websocket.core.io.payload; import java.nio.ByteBuffer; import org.eclipse.jetty.util.TypeUtil; -import org.eclipse.jetty.websocket.core.api.BadPayloadException; -import org.eclipse.jetty.websocket.core.io.payload.UTF8Validator; +import org.eclipse.jetty.websocket.api.BadPayloadException; +import org.eclipse.jetty.websocket.common.io.payload.UTF8Validator; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/AcceptHashTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/AcceptHashTest.java index 06b2a0003d5..c35a204ca10 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/AcceptHashTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/AcceptHashTest.java @@ -20,7 +20,7 @@ package org.eclipse.jetty.websocket.core.protocol; import org.eclipse.jetty.util.B64Code; import org.eclipse.jetty.util.TypeUtil; -import org.eclipse.jetty.websocket.core.protocol.AcceptHash; +import org.eclipse.jetty.websocket.common.AcceptHash; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/ClosePayloadParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/ClosePayloadParserTest.java index 1032a4a127f..bb7eb46cdd6 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/ClosePayloadParserTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/ClosePayloadParserTest.java @@ -21,12 +21,12 @@ package org.eclipse.jetty.websocket.core.protocol; import java.nio.ByteBuffer; import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.websocket.core.api.StatusCode; -import org.eclipse.jetty.websocket.core.api.WebSocketBehavior; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.Parser; +import org.eclipse.jetty.websocket.api.StatusCode; +import org.eclipse.jetty.websocket.api.WebSocketBehavior; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.Parser; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/GeneratorTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/GeneratorTest.java index 491a92e4be9..fb582400488 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/GeneratorTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/GeneratorTest.java @@ -24,14 +24,14 @@ import java.util.Arrays; import java.util.List; import org.eclipse.jetty.util.BufferUtil; +import org.eclipse.jetty.websocket.api.StatusCode; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.Generator; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.Parser; +import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.core.ByteBufferAssert; -import org.eclipse.jetty.websocket.core.api.StatusCode; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.Generator; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.Parser; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/IncomingFramesCapture.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/IncomingFramesCapture.java index 982016013ea..27231b3f2b2 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/IncomingFramesCapture.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/IncomingFramesCapture.java @@ -23,10 +23,10 @@ import java.util.LinkedList; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.WebSocketException; -import org.eclipse.jetty.websocket.core.io.IncomingFrames; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.io.IncomingFrames; import org.junit.Assert; import static org.hamcrest.Matchers.greaterThanOrEqualTo; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/OutgoingFramesCapture.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/OutgoingFramesCapture.java index 44385cd1bff..4fda2658bd7 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/OutgoingFramesCapture.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/OutgoingFramesCapture.java @@ -22,9 +22,9 @@ import java.util.LinkedList; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; -import org.eclipse.jetty.websocket.core.io.OutgoingFrames; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.io.OutgoingFrames; import org.junit.Assert; import static org.hamcrest.Matchers.greaterThanOrEqualTo; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/OutgoingNetworkBytesCapture.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/OutgoingNetworkBytesCapture.java index 2ce24d94682..e783720e428 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/OutgoingNetworkBytesCapture.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/OutgoingNetworkBytesCapture.java @@ -28,7 +28,9 @@ import java.util.List; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.TypeUtil; -import org.eclipse.jetty.websocket.core.io.OutgoingFrames; +import org.eclipse.jetty.websocket.common.Generator; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.eclipse.jetty.websocket.common.io.OutgoingFrames; import org.junit.Assert; /** diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/ParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/ParserTest.java index 3ab3485170a..2ef93e1768a 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/ParserTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/ParserTest.java @@ -29,10 +29,14 @@ import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.TypeUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.api.BadPayloadException; -import org.eclipse.jetty.websocket.core.api.StatusCode; -import org.eclipse.jetty.websocket.core.api.WebSocketBehavior; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.BadPayloadException; +import org.eclipse.jetty.websocket.api.StatusCode; +import org.eclipse.jetty.websocket.api.WebSocketBehavior; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.Parser; +import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/PingPayloadParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/PingPayloadParserTest.java index 29cd8999f76..9ec721620f9 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/PingPayloadParserTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/PingPayloadParserTest.java @@ -21,11 +21,11 @@ package org.eclipse.jetty.websocket.core.protocol; import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; -import org.eclipse.jetty.websocket.core.api.WebSocketBehavior; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.Parser; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.WebSocketBehavior; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.Parser; +import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/RFC6455ExamplesGeneratorTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/RFC6455ExamplesGeneratorTest.java index 3a56ca57939..e01b9aaa73a 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/RFC6455ExamplesGeneratorTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/RFC6455ExamplesGeneratorTest.java @@ -21,10 +21,10 @@ package org.eclipse.jetty.websocket.core.protocol; import java.nio.ByteBuffer; import java.util.Arrays; +import org.eclipse.jetty.websocket.common.Generator; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.core.ByteBufferAssert; -import org.eclipse.jetty.websocket.core.protocol.Generator; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.Test; public class RFC6455ExamplesGeneratorTest diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/RFC6455ExamplesParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/RFC6455ExamplesParserTest.java index 80b3f84376e..bad92b40e89 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/RFC6455ExamplesParserTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/RFC6455ExamplesParserTest.java @@ -21,11 +21,11 @@ package org.eclipse.jetty.websocket.core.protocol; import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; -import org.eclipse.jetty.websocket.core.api.WebSocketBehavior; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.Parser; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.WebSocketBehavior; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.Parser; +import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/TextPayloadParserTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/TextPayloadParserTest.java index fc3b64532a8..764ba57764b 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/TextPayloadParserTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/TextPayloadParserTest.java @@ -22,13 +22,13 @@ import java.nio.ByteBuffer; import java.util.Arrays; import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.websocket.core.api.MessageTooLargeException; -import org.eclipse.jetty.websocket.core.api.StatusCode; -import org.eclipse.jetty.websocket.core.api.WebSocketBehavior; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.Parser; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.MessageTooLargeException; +import org.eclipse.jetty.websocket.api.StatusCode; +import org.eclipse.jetty.websocket.api.WebSocketBehavior; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.Parser; +import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/UnitGenerator.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/UnitGenerator.java index f6a48a0a69e..04db7b11225 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/UnitGenerator.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/UnitGenerator.java @@ -23,9 +23,9 @@ import java.util.List; import org.eclipse.jetty.io.MappedByteBufferPool; import org.eclipse.jetty.util.BufferUtil; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.Generator; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.Generator; +import org.eclipse.jetty.websocket.common.WebSocketFrame; /** * Convenience Generator. diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/UnitParser.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/UnitParser.java index 67d28c08a24..84374e2c370 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/UnitParser.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/UnitParser.java @@ -20,8 +20,8 @@ package org.eclipse.jetty.websocket.core.protocol; import java.nio.ByteBuffer; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.Parser; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.Parser; public class UnitParser extends Parser { diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/WebSocketFrameTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/WebSocketFrameTest.java index 3ad823c70e9..3f94108a933 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/WebSocketFrameTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/core/protocol/WebSocketFrameTest.java @@ -23,13 +23,13 @@ import java.nio.ByteBuffer; import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.MappedByteBufferPool; import org.eclipse.jetty.util.BufferUtil; +import org.eclipse.jetty.websocket.api.StatusCode; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.Generator; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.core.ByteBufferAssert; -import org.eclipse.jetty.websocket.core.api.StatusCode; -import org.eclipse.jetty.websocket.core.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.core.protocol.CloseInfo; -import org.eclipse.jetty.websocket.core.protocol.Generator; -import org.eclipse.jetty.websocket.core.protocol.OpCode; -import org.eclipse.jetty.websocket.core.protocol.WebSocketFrame; import org.junit.BeforeClass; import org.junit.Test;