From 5cf9640cfa080bbef26ffe15f52f2d79064a6339 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Fri, 20 Dec 2013 11:56:22 -0700 Subject: [PATCH] 423724 - WebSocket / Rename MessageAppender.appendMessage to .appendFrame --- .../jsr356/endpoints/JsrEndpointEventDriver.java | 4 ++-- .../jsr356/messages/BinaryPartialMessage.java | 2 +- .../jsr356/messages/BinaryPartialOnMessage.java | 2 +- .../websocket/jsr356/messages/TextPartialMessage.java | 2 +- .../jsr356/messages/TextPartialOnMessage.java | 2 +- .../websocket/common/WebSocketRemoteEndpoint.java | 4 ---- .../websocket/common/events/AbstractEventDriver.java | 2 +- .../websocket/common/message/MessageAppender.java | 2 +- .../websocket/common/message/MessageInputStream.java | 2 +- .../jetty/websocket/common/message/MessageReader.java | 4 ++-- .../websocket/common/message/SimpleBinaryMessage.java | 2 +- .../websocket/common/message/SimpleTextMessage.java | 2 +- .../common/message/MessageInputStreamTest.java | 10 +++++----- 13 files changed, 18 insertions(+), 22 deletions(-) diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrEndpointEventDriver.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrEndpointEventDriver.java index d0e49d3e7c7..28de184fc4f 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrEndpointEventDriver.java +++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrEndpointEventDriver.java @@ -102,7 +102,7 @@ public class JsrEndpointEventDriver extends AbstractJsrEventDriver implements Ev } } - activeMessage.appendMessage(buffer,fin); + activeMessage.appendFrame(buffer,fin); if (fin) { @@ -198,7 +198,7 @@ public class JsrEndpointEventDriver extends AbstractJsrEventDriver implements Ev } } - activeMessage.appendMessage(buffer,fin); + activeMessage.appendFrame(buffer,fin); if (fin) { diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/BinaryPartialMessage.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/BinaryPartialMessage.java index db98eca21f9..475b172d30d 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/BinaryPartialMessage.java +++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/BinaryPartialMessage.java @@ -44,7 +44,7 @@ public class BinaryPartialMessage implements MessageAppender } @Override - public void appendMessage(ByteBuffer payload, boolean isLast) throws IOException + public void appendFrame(ByteBuffer payload, boolean isLast) throws IOException { // No decoders for Partial messages per JSR-356 (PFD1 spec) diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/BinaryPartialOnMessage.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/BinaryPartialOnMessage.java index 5b6e828fbde..1a0abc3d7f5 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/BinaryPartialOnMessage.java +++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/BinaryPartialOnMessage.java @@ -40,7 +40,7 @@ public class BinaryPartialOnMessage implements MessageAppender } @Override - public void appendMessage(ByteBuffer payload, boolean isLast) throws IOException + public void appendFrame(ByteBuffer payload, boolean isLast) throws IOException { if (finished) { diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/TextPartialMessage.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/TextPartialMessage.java index 23934c42d3a..86115093808 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/TextPartialMessage.java +++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/TextPartialMessage.java @@ -45,7 +45,7 @@ public class TextPartialMessage implements MessageAppender } @Override - public void appendMessage(ByteBuffer payload, boolean isLast) throws IOException + public void appendFrame(ByteBuffer payload, boolean isLast) throws IOException { // No decoders for Partial messages per JSR-356 (PFD1 spec) partialHandler.onMessage(BufferUtil.toUTF8String(payload.slice()),isLast); diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/TextPartialOnMessage.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/TextPartialOnMessage.java index bdef7eb99a8..b63c9b423ad 100644 --- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/TextPartialOnMessage.java +++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/messages/TextPartialOnMessage.java @@ -40,7 +40,7 @@ public class TextPartialOnMessage implements MessageAppender } @Override - public void appendMessage(ByteBuffer payload, boolean isLast) throws IOException + public void appendFrame(ByteBuffer payload, boolean isLast) throws IOException { if (finished) { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpoint.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpoint.java index 1a25c5ec885..86e22fa20ba 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpoint.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketRemoteEndpoint.java @@ -24,7 +24,6 @@ import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.log.Log; @@ -45,9 +44,6 @@ import org.eclipse.jetty.websocket.common.io.FutureWriteCallback; */ public class WebSocketRemoteEndpoint implements RemoteEndpoint { - /** JSR-356 blocking send behavior message */ - private static final String PRIORMSG_ERROR = "Prior message pending, cannot start new message yet."; - /** Message Type*/ private enum MsgType { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/AbstractEventDriver.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/AbstractEventDriver.java index 43d42838b37..2faf4048967 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/AbstractEventDriver.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/events/AbstractEventDriver.java @@ -57,7 +57,7 @@ public abstract class AbstractEventDriver implements IncomingFrames, EventDriver protected void appendMessage(ByteBuffer buffer, boolean fin) throws IOException { - activeMessage.appendMessage(buffer,fin); + activeMessage.appendFrame(buffer,fin); if (fin) { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageAppender.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageAppender.java index b4970ec62e7..f928550fc2d 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageAppender.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageAppender.java @@ -36,7 +36,7 @@ public interface MessageAppender * @throws IOException * if unable to append the frame payload */ - abstract void appendMessage(ByteBuffer framePayload, boolean isLast) throws IOException; + abstract void appendFrame(ByteBuffer framePayload, boolean isLast) throws IOException; /** * Notification that message is to be considered complete. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageInputStream.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageInputStream.java index a5803604956..91da522d3e3 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageInputStream.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageInputStream.java @@ -64,7 +64,7 @@ public class MessageInputStream extends InputStream implements MessageAppender } @Override - public void appendMessage(ByteBuffer framePayload, boolean fin) throws IOException + public void appendFrame(ByteBuffer framePayload, boolean fin) throws IOException { if (LOG.isDebugEnabled()) { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageReader.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageReader.java index c31a750a476..3c86b7da68a 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageReader.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageReader.java @@ -39,9 +39,9 @@ public class MessageReader extends InputStreamReader implements MessageAppender } @Override - public void appendMessage(ByteBuffer payload, boolean isLast) throws IOException + public void appendFrame(ByteBuffer payload, boolean isLast) throws IOException { - this.stream.appendMessage(payload,isLast); + this.stream.appendFrame(payload,isLast); } @Override diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/SimpleBinaryMessage.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/SimpleBinaryMessage.java index 274f7314c17..8efbc082e6f 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/SimpleBinaryMessage.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/SimpleBinaryMessage.java @@ -41,7 +41,7 @@ public class SimpleBinaryMessage implements MessageAppender } @Override - public void appendMessage(ByteBuffer payload, boolean isLast) throws IOException + public void appendFrame(ByteBuffer payload, boolean isLast) throws IOException { if (finished) { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/SimpleTextMessage.java b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/SimpleTextMessage.java index e002e1282b4..7b1a0f257a1 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/SimpleTextMessage.java +++ b/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/message/SimpleTextMessage.java @@ -40,7 +40,7 @@ public class SimpleTextMessage implements MessageAppender } @Override - public void appendMessage(ByteBuffer payload, boolean isLast) throws IOException + public void appendFrame(ByteBuffer payload, boolean isLast) throws IOException { if (finished) { diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageInputStreamTest.java b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageInputStreamTest.java index 4e4f2e7c493..31059be9a97 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageInputStreamTest.java +++ b/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/message/MessageInputStreamTest.java @@ -50,7 +50,7 @@ public class MessageInputStreamTest ByteBuffer payload = BufferUtil.toBuffer("Hello World",StandardCharsets.UTF_8); System.out.printf("payload = %s%n",BufferUtil.toDetailString(payload)); boolean fin = true; - stream.appendMessage(payload,fin); + stream.appendFrame(payload,fin); // Read entire message it from the stream. byte buf[] = new byte[32]; @@ -84,12 +84,12 @@ public class MessageInputStreamTest startLatch.countDown(); boolean fin = false; TimeUnit.MILLISECONDS.sleep(200); - stream.appendMessage(BufferUtil.toBuffer("Saved",StandardCharsets.UTF_8),fin); + stream.appendFrame(BufferUtil.toBuffer("Saved",StandardCharsets.UTF_8),fin); TimeUnit.MILLISECONDS.sleep(200); - stream.appendMessage(BufferUtil.toBuffer(" by ",StandardCharsets.UTF_8),fin); + stream.appendFrame(BufferUtil.toBuffer(" by ",StandardCharsets.UTF_8),fin); fin = true; TimeUnit.MILLISECONDS.sleep(200); - stream.appendMessage(BufferUtil.toBuffer("Zero",StandardCharsets.UTF_8),fin); + stream.appendFrame(BufferUtil.toBuffer("Zero",StandardCharsets.UTF_8),fin); } catch (IOException | InterruptedException e) { @@ -132,7 +132,7 @@ public class MessageInputStreamTest boolean fin = true; // wait for a little bit before populating buffers TimeUnit.MILLISECONDS.sleep(400); - stream.appendMessage(BufferUtil.toBuffer("I will conquer",StandardCharsets.UTF_8),fin); + stream.appendFrame(BufferUtil.toBuffer("I will conquer",StandardCharsets.UTF_8),fin); } catch (IOException | InterruptedException e) {