Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
863a835
fixes AvailableDecoders and AvailableEncoders
lachlan-roberts Jan 23, 2025
6356b1f
Allow parameterized types for jakarta websocket Decoders
lachlan-roberts Jan 30, 2025
c5a3c10
fixes for RegisteredDecoder/RegisteredEncoder isType
lachlan-roberts Jan 30, 2025
bbd9035
throw DeploymentException instead of InvalidSignatureException for ja…
lachlan-roberts Jan 30, 2025
57393c1
add toString for InvokerUtils.Arg to help debugging
lachlan-roberts Jan 31, 2025
6738791
fix InvokerUtils for non-existent pathParams
lachlan-roberts Jan 31, 2025
6507034
wrap return type of jakarta websocket PongMessage
lachlan-roberts Jan 31, 2025
fe4bbf7
fix isOpen for the JakartaWebSocketSession
lachlan-roberts Feb 4, 2025
6b1b7de
WebSocket Jakarta HandshakeRequest should include pathParams in getPa…
lachlan-roberts Feb 4, 2025
37bf06b
strip {} from pathParam values in PathParamIdentifier
lachlan-roberts Feb 4, 2025
4c2d269
allow jakarta websocket endpoints to continue after an error
lachlan-roberts Feb 4, 2025
d278e06
fix encoding issues with JakartaWebSocketAsyncRemote
lachlan-roberts Feb 5, 2025
3014391
jakarta remote endpoint classes should not send message in case of en…
lachlan-roberts Feb 5, 2025
cb23776
give optional failure from errors for dispatched message sinks
lachlan-roberts Feb 5, 2025
cf144cc
error handling fixes for Jakarta websocket RemoteEndpoints
lachlan-roberts Feb 5, 2025
5a8b039
fixes for error handling in JakartaWebSocketFrameHandler
lachlan-roberts Feb 6, 2025
290a61c
allow ReflectUtils.isAssignableFrom to match class subtype with param…
lachlan-roberts Feb 6, 2025
ba7c8ec
make HttpFieldsMap.containsKey case-insensitive
lachlan-roberts Feb 6, 2025
3c3a4bd
ensure jakarta websocket endpoints are cleared on deployment exception
lachlan-roberts Feb 6, 2025
749243d
JakartaWebSocketServerContainer should throw DE when duplicate endpoi…
lachlan-roberts Feb 6, 2025
b13dab4
avoid finding overriden methods in InvokerUtils.findAnnotatedMethods
lachlan-roberts Feb 7, 2025
3a8d8d2
failures in finding methods in Jakarta websocket should result in dep…
lachlan-roberts Feb 7, 2025
c39fe8b
allow CharacterDecoder to decode all length>0 to char
lachlan-roberts Feb 7, 2025
3ead428
calling MessageOutputStream close multiple times should not throw
lachlan-roberts Feb 7, 2025
f7161ae
throw if Jakarta WebSocket onMessage is invalid
lachlan-roberts Feb 10, 2025
02e913a
failure to upgrade jakarta websocket should throw deployment exception
lachlan-roberts Feb 10, 2025
d13f0c1
Fix failures in Jetty tests due to fixes for WebSocket TCK
lachlan-roberts Feb 27, 2025
c1a7fc3
Fixes for WSServer trying to copy a class from a JAR file
lachlan-roberts Mar 4, 2025
bdae57a
PR #12830 - changes from review
lachlan-roberts Mar 5, 2025
27f13f8
Merge remote-tracking branch 'origin/websocket-tck' into websocket-tc…
lachlan-roberts Mar 5, 2025
59ebdb6
PR #12875 - fix build issues
lachlan-roberts Mar 5, 2025
b1b2ab1
invoke onError when sending ws abnormal status code
lachlan-roberts Mar 18, 2025
541bcc2
PR #12875 - Fix checkstyle error.
lachlan-roberts Apr 1, 2025
f4e24cf
PR #12875 - fix test expectations in GracefulCloseTest
lachlan-roberts Apr 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ public List<String> remove(Object key)
return null;
}

@Override
public boolean containsKey(Object key)
{
if (key instanceof String s)
return httpFields.contains(s);
return false;
}

@Override
public Set<Entry<String, List<String>>> entrySet()
{
Expand Down Expand Up @@ -178,6 +186,14 @@ public List<String> remove(Object key)
throw new UnsupportedOperationException();
}

@Override
public boolean containsKey(Object key)
{
if (key instanceof String s)
return httpFields.contains(s);
return false;
}

@Override
public Set<Entry<String, List<String>>> entrySet()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
public abstract class AbstractMessageSink implements MessageSink
{
private final CoreSession session;
private final MethodHolder methodHandle;
private final MethodHolder methodHolder;
private final boolean autoDemand;

/**
Expand All @@ -56,7 +56,7 @@ public abstract class AbstractMessageSink implements MessageSink
public AbstractMessageSink(CoreSession session, MethodHolder methodHolder, boolean autoDemand)
{
this.session = Objects.requireNonNull(session, "CoreSession");
this.methodHandle = Objects.requireNonNull(methodHolder, "MethodHolder");
this.methodHolder = Objects.requireNonNull(methodHolder, "MethodHolder");
this.autoDemand = autoDemand;
}

Expand All @@ -75,7 +75,7 @@ public CoreSession getCoreSession()
*/
public MethodHolder getMethodHolder()
{
return methodHandle;
return methodHolder;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Consumer;

import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.IO;
Expand Down Expand Up @@ -48,8 +50,10 @@
public abstract class DispatchedMessageSink extends AbstractMessageSink
{
private final Executor executor;
private final AtomicBoolean wasCallbackFailed = new AtomicBoolean(false);
private volatile CompletableFuture<Void> dispatchComplete;
private MessageSink typeSink;
private Consumer<Throwable> onError;

public DispatchedMessageSink(CoreSession session, MethodHolder methodHolder, boolean autoDemand)
{
Expand All @@ -59,6 +63,15 @@ public DispatchedMessageSink(CoreSession session, MethodHolder methodHolder, boo
executor = session.getWebSocketComponents().getExecutor();
}

public DispatchedMessageSink(CoreSession session, MethodHolder methodHolder, boolean autoDemand, Consumer<Throwable> onError)
{
super(session, methodHolder, autoDemand);
if (!autoDemand)
throw new IllegalArgumentException("%s must be auto-demanding".formatted(getClass().getSimpleName()));
this.executor = session.getWebSocketComponents().getExecutor();
this.onError = onError;
}

public abstract MessageSink newMessageSink();

public void accept(Frame frame, final Callback callback)
Expand Down Expand Up @@ -105,17 +118,31 @@ public void accept(Frame frame, final Callback callback)
{
autoDemand();
}
else
// We only need to handle the error here if none of the callbacks were ever failed.
else if (!wasCallbackFailed.get())
{
if (failure instanceof CompletionException completionException)
failure = completionException.getCause();

CloseStatus closeStatus = new CloseStatus(CloseStatus.SERVER_ERROR, failure);
getCoreSession().close(closeStatus, Callback.NOOP);
if (onError == null)
{
CloseStatus closeStatus = new CloseStatus(CloseStatus.SERVER_ERROR, failure);
getCoreSession().close(closeStatus, Callback.NOOP);
}
else
{
onError.accept(failure);
}
}
});
}

frameCallback = Callback.from(frameCallback::succeeded, throwable ->
{
if (throwable != null)
wasCallbackFailed.set(true);
callback.failed(throwable);
});
typeSink.accept(frame, frameCallback);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

package org.eclipse.jetty.websocket.core.messages;

import java.util.function.Consumer;

import org.eclipse.jetty.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.util.MethodHolder;

Expand All @@ -23,6 +25,11 @@ public InputStreamMessageSink(CoreSession session, MethodHolder methodHolder, bo
super(session, methodHolder, autoDemand);
}

public InputStreamMessageSink(CoreSession session, MethodHolder methodHolder, boolean autoDemand, Consumer<Throwable> onError)
{
super(session, methodHolder, autoDemand, onError);
}

@Override
public MessageSink newMessageSink()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ public void close() throws IOException
{
try
{
if (closed)
return;

flush(true);
buffer.release();
if (LOG.isDebugEnabled())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

package org.eclipse.jetty.websocket.core.messages;

import java.util.function.Consumer;

import org.eclipse.jetty.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.util.MethodHolder;

Expand All @@ -23,6 +25,11 @@ public ReaderMessageSink(CoreSession session, MethodHolder methodHolder, boolean
super(session, methodHolder, autoDemand);
}

public ReaderMessageSink(CoreSession session, MethodHolder methodHolder, boolean autoDemand, Consumer<Throwable> onError)
{
super(session, methodHolder, autoDemand, onError);
}

@Override
public MessageReader newMessageSink()
{
Expand Down
Loading