423724 - WebSocket / Rename MessageAppender.appendMessage to .appendFrame
This commit is contained in:
parent
7a51f602dd
commit
5cf9640cfa
|
@ -102,7 +102,7 @@ public class JsrEndpointEventDriver extends AbstractJsrEventDriver implements Ev
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
activeMessage.appendMessage(buffer,fin);
|
activeMessage.appendFrame(buffer,fin);
|
||||||
|
|
||||||
if (fin)
|
if (fin)
|
||||||
{
|
{
|
||||||
|
@ -198,7 +198,7 @@ public class JsrEndpointEventDriver extends AbstractJsrEventDriver implements Ev
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
activeMessage.appendMessage(buffer,fin);
|
activeMessage.appendFrame(buffer,fin);
|
||||||
|
|
||||||
if (fin)
|
if (fin)
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class BinaryPartialMessage implements MessageAppender
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)
|
// No decoders for Partial messages per JSR-356 (PFD1 spec)
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class BinaryPartialOnMessage implements MessageAppender
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendMessage(ByteBuffer payload, boolean isLast) throws IOException
|
public void appendFrame(ByteBuffer payload, boolean isLast) throws IOException
|
||||||
{
|
{
|
||||||
if (finished)
|
if (finished)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class TextPartialMessage implements MessageAppender
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)
|
// No decoders for Partial messages per JSR-356 (PFD1 spec)
|
||||||
partialHandler.onMessage(BufferUtil.toUTF8String(payload.slice()),isLast);
|
partialHandler.onMessage(BufferUtil.toUTF8String(payload.slice()),isLast);
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class TextPartialOnMessage implements MessageAppender
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendMessage(ByteBuffer payload, boolean isLast) throws IOException
|
public void appendFrame(ByteBuffer payload, boolean isLast) throws IOException
|
||||||
{
|
{
|
||||||
if (finished)
|
if (finished)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.util.BufferUtil;
|
import org.eclipse.jetty.util.BufferUtil;
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
|
@ -45,9 +44,6 @@ import org.eclipse.jetty.websocket.common.io.FutureWriteCallback;
|
||||||
*/
|
*/
|
||||||
public class WebSocketRemoteEndpoint implements RemoteEndpoint
|
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*/
|
/** Message Type*/
|
||||||
private enum MsgType
|
private enum MsgType
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,7 +57,7 @@ public abstract class AbstractEventDriver implements IncomingFrames, EventDriver
|
||||||
|
|
||||||
protected void appendMessage(ByteBuffer buffer, boolean fin) throws IOException
|
protected void appendMessage(ByteBuffer buffer, boolean fin) throws IOException
|
||||||
{
|
{
|
||||||
activeMessage.appendMessage(buffer,fin);
|
activeMessage.appendFrame(buffer,fin);
|
||||||
|
|
||||||
if (fin)
|
if (fin)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,7 @@ public interface MessageAppender
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* if unable to append the frame payload
|
* 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.
|
* Notification that message is to be considered complete.
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class MessageInputStream extends InputStream implements MessageAppender
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendMessage(ByteBuffer framePayload, boolean fin) throws IOException
|
public void appendFrame(ByteBuffer framePayload, boolean fin) throws IOException
|
||||||
{
|
{
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,9 +39,9 @@ public class MessageReader extends InputStreamReader implements MessageAppender
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@Override
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class SimpleBinaryMessage implements MessageAppender
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendMessage(ByteBuffer payload, boolean isLast) throws IOException
|
public void appendFrame(ByteBuffer payload, boolean isLast) throws IOException
|
||||||
{
|
{
|
||||||
if (finished)
|
if (finished)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class SimpleTextMessage implements MessageAppender
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void appendMessage(ByteBuffer payload, boolean isLast) throws IOException
|
public void appendFrame(ByteBuffer payload, boolean isLast) throws IOException
|
||||||
{
|
{
|
||||||
if (finished)
|
if (finished)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class MessageInputStreamTest
|
||||||
ByteBuffer payload = BufferUtil.toBuffer("Hello World",StandardCharsets.UTF_8);
|
ByteBuffer payload = BufferUtil.toBuffer("Hello World",StandardCharsets.UTF_8);
|
||||||
System.out.printf("payload = %s%n",BufferUtil.toDetailString(payload));
|
System.out.printf("payload = %s%n",BufferUtil.toDetailString(payload));
|
||||||
boolean fin = true;
|
boolean fin = true;
|
||||||
stream.appendMessage(payload,fin);
|
stream.appendFrame(payload,fin);
|
||||||
|
|
||||||
// Read entire message it from the stream.
|
// Read entire message it from the stream.
|
||||||
byte buf[] = new byte[32];
|
byte buf[] = new byte[32];
|
||||||
|
@ -84,12 +84,12 @@ public class MessageInputStreamTest
|
||||||
startLatch.countDown();
|
startLatch.countDown();
|
||||||
boolean fin = false;
|
boolean fin = false;
|
||||||
TimeUnit.MILLISECONDS.sleep(200);
|
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);
|
TimeUnit.MILLISECONDS.sleep(200);
|
||||||
stream.appendMessage(BufferUtil.toBuffer(" by ",StandardCharsets.UTF_8),fin);
|
stream.appendFrame(BufferUtil.toBuffer(" by ",StandardCharsets.UTF_8),fin);
|
||||||
fin = true;
|
fin = true;
|
||||||
TimeUnit.MILLISECONDS.sleep(200);
|
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)
|
catch (IOException | InterruptedException e)
|
||||||
{
|
{
|
||||||
|
@ -132,7 +132,7 @@ public class MessageInputStreamTest
|
||||||
boolean fin = true;
|
boolean fin = true;
|
||||||
// wait for a little bit before populating buffers
|
// wait for a little bit before populating buffers
|
||||||
TimeUnit.MILLISECONDS.sleep(400);
|
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)
|
catch (IOException | InterruptedException e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue