Skip to content

Commit

Permalink
Merge pull request #8598 from eclipse/jetty-12.0.x-RemoteEndpointApiFix
Browse files Browse the repository at this point in the history
Complete TODO to fix WebSocket RemoteEndpoint API in Jetty 12
  • Loading branch information
lachlan-roberts authored Sep 21, 2022
2 parents 97dd7b3 + e43346b commit 050b4a9
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ public interface RemoteEndpoint
* @param fragment the text being sent
* @param isLast true if this is the last piece of the partial bytes
* @param callback callback to notify of success or failure of the write operation
* @throws IOException this never throws IOException, it was a mistake to have this in the signature.
*/
void sendPartialString(String fragment, boolean isLast, WriteCallback callback) throws IOException;
void sendPartialString(String fragment, boolean isLast, WriteCallback callback);

/**
* Send a Ping message containing the given application data to the remote endpoint, blocking until all of the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ public void sendPartialString(String fragment, boolean isLast) throws IOExceptio
b.block(getBlockingTimeout(), TimeUnit.MILLISECONDS);
}

// FIXME: Remove the throws IOException from API for this method in the next major release.
@Override
public void sendPartialString(String fragment, boolean isLast, WriteCallback callback)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

package org.eclipse.jetty.ee10.websocket.tests;

import java.io.IOException;
import java.net.URI;
import java.nio.ByteBuffer;
import java.util.Objects;
Expand Down Expand Up @@ -62,14 +61,7 @@ public void onWebSocketPartialBinary(ByteBuffer payload, boolean fin)
@Override
public void onWebSocketPartialText(String payload, boolean fin)
{
try
{
session.getRemote().sendPartialString(payload, fin, WriteCallback.NOOP);
}
catch (IOException e)
{
throw new IllegalStateException(e);
}
session.getRemote().sendPartialString(payload, fin, WriteCallback.NOOP);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ public interface RemoteEndpoint
* @param fragment the text being sent
* @param isLast true if this is the last piece of the partial bytes
* @param callback callback to notify of success or failure of the write operation
* @throws IOException this never throws IOException, it was a mistake to have this in the signature.
*/
void sendPartialString(String fragment, boolean isLast, WriteCallback callback) throws IOException;
void sendPartialString(String fragment, boolean isLast, WriteCallback callback);

/**
* Send a Ping message containing the given application data to the remote endpoint, blocking until all of the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ public void sendPartialString(String fragment, boolean isLast) throws IOExceptio
b.block(getBlockingTimeout(), TimeUnit.MILLISECONDS);
}

// FIXME: Remove the throws IOException from API for this method in the next major release.
@Override
public void sendPartialString(String fragment, boolean isLast, WriteCallback callback)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

package org.eclipse.jetty.ee9.websocket.tests;

import java.io.IOException;
import java.net.URI;
import java.nio.ByteBuffer;
import java.util.Objects;
Expand Down Expand Up @@ -62,14 +61,7 @@ public void onWebSocketPartialBinary(ByteBuffer payload, boolean fin)
@Override
public void onWebSocketPartialText(String payload, boolean fin)
{
try
{
session.getRemote().sendPartialString(payload, fin, WriteCallback.NOOP);
}
catch (IOException e)
{
throw new IllegalStateException(e);
}
session.getRemote().sendPartialString(payload, fin, WriteCallback.NOOP);
}
}

Expand Down

0 comments on commit 050b4a9

Please sign in to comment.