Issue #3298 - bug fixes for jetty websockets

succeed callback when you do not have a message sink

OnWebSocketFrame annotation should take an API frame not a core frame

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2019-01-31 22:24:09 +11:00
parent bd4f9b30fc
commit 6a98cc0bd2
4 changed files with 6 additions and 4 deletions

View File

@ -236,7 +236,10 @@ public class JettyWebSocketFrameHandler implements FrameHandler
{
// No message sink is active
if (activeMessageSink == null)
{
callback.succeeded();
return;
}
// Accept the payload into the message sink
activeMessageSink.accept(frame, callback);

View File

@ -61,7 +61,6 @@ import org.eclipse.jetty.websocket.common.message.PartialTextMessageSink;
import org.eclipse.jetty.websocket.common.message.ReaderMessageSink;
import org.eclipse.jetty.websocket.common.message.StringMessageSink;
import org.eclipse.jetty.websocket.common.util.ReflectUtils;
import org.eclipse.jetty.websocket.core.Frame;
/**
* Factory to create {@link JettyWebSocketFrameHandler} instances suitable for
@ -351,7 +350,7 @@ public class JettyWebSocketFrameHandlerFactory extends ContainerLifeCycle
{
assertSignatureValid(endpointClass, onmethod, OnWebSocketFrame.class);
final InvokerUtils.Arg SESSION = new InvokerUtils.Arg(Session.class);
final InvokerUtils.Arg FRAME = new InvokerUtils.Arg(Frame.class).required();
final InvokerUtils.Arg FRAME = new InvokerUtils.Arg(org.eclipse.jetty.websocket.api.extensions.Frame.class).required();
MethodHandle methodHandle = InvokerUtils.mutatedInvoker(endpointClass, onmethod, SESSION, FRAME);
metadata.setFrameHandler(methodHandle, onmethod);
}

View File

@ -20,7 +20,7 @@ package org.eclipse.jetty.websocket.common.endpoints.annotated;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketFrame;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.websocket.core.Frame;
import org.eclipse.jetty.websocket.api.extensions.Frame;
@WebSocket
public class FrameSocket

View File

@ -40,7 +40,7 @@ import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class JettyWebsocketTest
public class JettyWebSocketTest
{
@WebSocket