400255 - Using WebSocket.maxMessageSize results in IllegalArgumentException
This commit is contained in:
parent
ade135ba74
commit
d505f481a4
|
@ -37,7 +37,7 @@ import org.eclipse.jetty.websocket.client.WebSocketClient;
|
||||||
*/
|
*/
|
||||||
public class SimpleEchoClient
|
public class SimpleEchoClient
|
||||||
{
|
{
|
||||||
@WebSocket
|
@WebSocket(maxMessageSize = 64 * 1024)
|
||||||
public static class SimpleEchoSocket
|
public static class SimpleEchoSocket
|
||||||
{
|
{
|
||||||
private final CountDownLatch closeLatch;
|
private final CountDownLatch closeLatch;
|
||||||
|
@ -107,7 +107,7 @@ public class SimpleEchoClient
|
||||||
|
|
||||||
URI echoUri = new URI(destUri);
|
URI echoUri = new URI(destUri);
|
||||||
ClientUpgradeRequest request = new ClientUpgradeRequest();
|
ClientUpgradeRequest request = new ClientUpgradeRequest();
|
||||||
request.addExtensions("x-webkit-deflate-frame");
|
// request.addExtensions("x-webkit-deflate-frame");
|
||||||
client.connect(socket,echoUri,request);
|
client.connect(socket,echoUri,request);
|
||||||
System.out.printf("Connecting to : %s%n",echoUri);
|
System.out.printf("Connecting to : %s%n",echoUri);
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,11 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
|
||||||
|
|
||||||
private static final Logger LOG = Log.getLogger(AbstractWebSocketConnection.class);
|
private static final Logger LOG = Log.getLogger(AbstractWebSocketConnection.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimum size of a buffer is the determined to be what would be the maximum framing header size (not including payload)
|
||||||
|
*/
|
||||||
|
private static final int MIN_BUFFER_SIZE = Generator.OVERHEAD;
|
||||||
|
|
||||||
private final ForkInvoker<Callback> invoker = new FlushInvoker();
|
private final ForkInvoker<Callback> invoker = new FlushInvoker();
|
||||||
private final ByteBufferPool bufferPool;
|
private final ByteBufferPool bufferPool;
|
||||||
private final Scheduler scheduler;
|
private final Scheduler scheduler;
|
||||||
|
@ -501,6 +506,15 @@ public abstract class AbstractWebSocketConnection extends AbstractConnection imp
|
||||||
this.extensions = extensions;
|
this.extensions = extensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInputBufferSize(int inputBufferSize)
|
||||||
|
{
|
||||||
|
if(inputBufferSize < MIN_BUFFER_SIZE) {
|
||||||
|
throw new IllegalArgumentException("Cannot have buffer size less than " + MIN_BUFFER_SIZE);
|
||||||
|
}
|
||||||
|
super.setInputBufferSize(inputBufferSize);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSession(WebSocketSession session)
|
public void setSession(WebSocketSession session)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue