Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for EE11 Jakarta WebSocket implementation to fix TCK failures. #12875

Open
wants to merge 32 commits into
base: jetty-12.1.x
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
32 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
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
Prev Previous commit
Next Next commit
jakarta remote endpoint classes should not send message in case of en…
…coding failure

Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
lachlan-roberts committed Feb 5, 2025
commit 30143913c461e524ba2beef8052bf3d62f923fda
Original file line number Diff line number Diff line change
@@ -126,6 +126,7 @@ else if (encoder instanceof Encoder.TextStream textStreamEncoder)
MessageWriter writer = newMessageWriter();
writer.setCallback(new SendHandlerCallback(handler));
textStreamEncoder.encode(data, writer);
writer.close();
}
catch (EncodeException | IOException e)
{
@@ -154,6 +155,7 @@ else if (encoder instanceof Encoder.BinaryStream binaryStreamEncoder)
MessageOutputStream out = newMessageOutputStream();
out.setCallback(callback);
binaryStreamEncoder.encode(data, out);
out.close();
}
catch (EncodeException | IOException e)
{
Original file line number Diff line number Diff line change
@@ -148,57 +148,48 @@ else if ((messageType == OpCode.TEXT) && (opcode == OpCode.BINARY))
}
}

@SuppressWarnings({"rawtypes", "unchecked"})
public void sendObject(Object data, Callback callback) throws IOException, EncodeException
{
try
{
assertMessageNotNull(data);
if (LOG.isDebugEnabled())
{
LOG.debug("sendObject({}, {})", data, callback);
}

Encoder encoder = session.getEncoders().getInstanceFor(data.getClass());
if (encoder == null)
{
throw new IllegalArgumentException("No encoder for type: " + data.getClass());
}

if (encoder instanceof Encoder.Text)
if (encoder instanceof Encoder.Text textEncoder)
{
Encoder.Text text = (Encoder.Text)encoder;
String msg = text.encode(data);
String msg = textEncoder.encode(data);
sendFrame(new Frame(OpCode.TEXT).setPayload(msg), callback, batch);
return;
}

if (encoder instanceof Encoder.TextStream)
if (encoder instanceof Encoder.TextStream textStreamEncoder)
{
Encoder.TextStream etxt = (Encoder.TextStream)encoder;
try (MessageWriter writer = newMessageWriter())
{
writer.setCallback(callback);
etxt.encode(data, writer);
}
MessageWriter writer = newMessageWriter();
writer.setCallback(callback);
textStreamEncoder.encode(data, writer);
writer.close();
return;
}

if (encoder instanceof Encoder.Binary)
if (encoder instanceof Encoder.Binary binaryEncoder)
{
Encoder.Binary ebin = (Encoder.Binary)encoder;
ByteBuffer buf = ebin.encode(data);
ByteBuffer buf = binaryEncoder.encode(data);
sendFrame(new Frame(OpCode.BINARY).setPayload(buf), callback, batch);
return;
}

if (encoder instanceof Encoder.BinaryStream)
if (encoder instanceof Encoder.BinaryStream binaryStreamEncoder)
{
Encoder.BinaryStream ebin = (Encoder.BinaryStream)encoder;
try (MessageOutputStream out = newMessageOutputStream())
{
out.setCallback(callback);
ebin.encode(data, out);
}
MessageOutputStream out = newMessageOutputStream();
out.setCallback(callback);
binaryStreamEncoder.encode(data, out);
out.close();
return;
}