Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/ClientContainer.java5
-rw-r--r--jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/ServerContainer.java8
-rw-r--r--jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java34
3 files changed, 16 insertions, 31 deletions
diff --git a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/ClientContainer.java b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/ClientContainer.java
index c6650c2434..34a7d14fd4 100644
--- a/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/ClientContainer.java
+++ b/jetty-websocket/javax-websocket-client-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/ClientContainer.java
@@ -308,14 +308,15 @@ public class ClientContainer extends ContainerLifeCycle implements WebSocketCont
@Override
public void setAsyncSendTimeout(long ms)
{
- client.setMaxIdleTimeout(ms);
client.setAsyncWriteTimeout(ms);
}
@Override
public void setDefaultMaxBinaryMessageBufferSize(int max)
{
+ // overall message limit (used in non-streaming)
client.getPolicy().setMaxBinaryMessageSize(max);
+ // incoming streaming buffer size
client.setMaxBinaryMessageBufferSize(max);
}
@@ -328,7 +329,9 @@ public class ClientContainer extends ContainerLifeCycle implements WebSocketCont
@Override
public void setDefaultMaxTextMessageBufferSize(int max)
{
+ // overall message limit (used in non-streaming)
client.getPolicy().setMaxTextMessageSize(max);
+ // incoming streaming buffer size
client.setMaxTextMessageBufferSize(max);
}
}
diff --git a/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/ServerContainer.java b/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/ServerContainer.java
index f87c41660d..68518884cc 100644
--- a/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/ServerContainer.java
+++ b/jetty-websocket/javax-websocket-server-impl/src/main/java/org/eclipse/jetty/websocket/jsr356/server/ServerContainer.java
@@ -148,7 +148,7 @@ public class ServerContainer extends ClientContainer implements javax.websocket.
@Override
public int getDefaultMaxBinaryMessageBufferSize()
{
- return webSocketServerFactory.getPolicy().getMaxBinaryMessageBufferSize();
+ return webSocketServerFactory.getPolicy().getMaxBinaryMessageSize();
}
@Override
@@ -160,7 +160,7 @@ public class ServerContainer extends ClientContainer implements javax.websocket.
@Override
public int getDefaultMaxTextMessageBufferSize()
{
- return webSocketServerFactory.getPolicy().getMaxTextMessageBufferSize();
+ return webSocketServerFactory.getPolicy().getMaxTextMessageSize();
}
@Override
@@ -172,7 +172,9 @@ public class ServerContainer extends ClientContainer implements javax.websocket.
@Override
public void setDefaultMaxBinaryMessageBufferSize(int max)
{
+ // overall message limit (used in non-streaming)
webSocketServerFactory.getPolicy().setMaxBinaryMessageSize(max);
+ // incoming streaming buffer size
webSocketServerFactory.getPolicy().setMaxBinaryMessageBufferSize(max);
}
@@ -185,7 +187,9 @@ public class ServerContainer extends ClientContainer implements javax.websocket.
@Override
public void setDefaultMaxTextMessageBufferSize(int max)
{
+ // overall message limit (used in non-streaming)
webSocketServerFactory.getPolicy().setMaxTextMessageSize(max);
+ // incoming streaming buffer size
webSocketServerFactory.getPolicy().setMaxTextMessageBufferSize(max);
}
}
diff --git a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java
index de9cb3f942..afb3c505cf 100644
--- a/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java
+++ b/jetty-websocket/websocket-api/src/main/java/org/eclipse/jetty/websocket/api/WebSocketPolicy.java
@@ -47,9 +47,7 @@ public class WebSocketPolicy
/**
* The maximum size of a text message buffer.
* <p>
- * Used primarily for stream based messaging.
- * <p>
- * Note: Cannot be greater than {@link #maxTextMessageSize}, or less than {@link #inputBufferSize}
+ * Used ONLY for stream based message writing.
* <p>
* Default: 32768 (32 K)
*/
@@ -67,9 +65,7 @@ public class WebSocketPolicy
/**
* The maximum size of a binary message buffer
* <p>
- * Used primarily for stream based messaging.
- * <p>
- * Note: Cannot be greater than {@link #maxBinaryMessageSize}, or less than {@link #inputBufferSize}
+ * Used ONLY for for stream based message writing
* <p>
* Default: 32768 (32 K)
*/
@@ -106,14 +102,6 @@ public class WebSocketPolicy
this.behavior = behavior;
}
- private void assertGreaterThan(String name, long size, String otherName, long otherSize)
- {
- if (size < otherSize)
- {
- throw new IllegalArgumentException(String.format("%s [%d] must be greater than %s [%d]",name,size,otherName,otherSize));
- }
- }
-
private void assertLessThan(String name, long size, String otherName, long otherSize)
{
if (size > otherSize)
@@ -207,7 +195,7 @@ public class WebSocketPolicy
}
/**
- * Get the maximum size of a binary message buffer
+ * Get the maximum size of a binary message buffer (for streaming writing)
* <p>
* Note: Cannot be greater than {@link #getMaxBinaryMessageSize()}
*
@@ -231,7 +219,7 @@ public class WebSocketPolicy
}
/**
- * Get the maximum size of a text message buffer.
+ * Get the maximum size of a text message buffer (for streaming writing)
* <p>
* Note: Cannot be greater than {@link #maxTextMessageSize}
*
@@ -298,9 +286,7 @@ public class WebSocketPolicy
/**
* The maximum size of a binary message buffer.
* <p>
- * Used primarily for stream based messaging.
- * <p>
- * Note: Cannot be greater than {@link #getMaxBinaryMessageSize()} or less than {@link #getInputBufferSize()}
+ * Used ONLY for stream based message writing.
*
* @param size
* the maximum size of the binary message buffer
@@ -308,8 +294,6 @@ public class WebSocketPolicy
public void setMaxBinaryMessageBufferSize(int size)
{
assertPositive("MaxBinaryMessageBufferSize",size);
- assertLessThan("MaxBinaryMessageBufferSize",size,"MaxBinaryMessageSize",maxBinaryMessageSize);
- assertGreaterThan("MaxBinaryMessageBufferSize",size,"InputBufferSize",inputBufferSize);
this.maxBinaryMessageBufferSize = size;
}
@@ -325,7 +309,6 @@ public class WebSocketPolicy
public void setMaxBinaryMessageSize(int size)
{
assertPositive("MaxBinaryMessageSize",size);
- assertGreaterThan("MaxBinaryMessageSize",size,"MaxBinaryMessageBufferSize",maxBinaryMessageBufferSize);
this.maxBinaryMessageSize = size;
}
@@ -333,9 +316,7 @@ public class WebSocketPolicy
/**
* The maximum size of a text message buffer.
* <p>
- * Used primarily for stream based messaging.
- * <p>
- * Note: Cannot be greater than {@link #getMaxTextMessageSize()} or less than {@link #getInputBufferSize()}
+ * Used ONLY for stream based message writing.
*
* @param size
* the maximum size of the text message buffer
@@ -343,8 +324,6 @@ public class WebSocketPolicy
public void setMaxTextMessageBufferSize(int size)
{
assertPositive("MaxTextMessageBufferSize",size);
- assertLessThan("MaxTextMessageBufferSize",size,"MaxTextMessageSize",maxTextMessageSize);
- assertGreaterThan("MaxTextMessageBufferSize",size,"InputBufferSize",inputBufferSize);
this.maxTextMessageBufferSize = size;
}
@@ -360,7 +339,6 @@ public class WebSocketPolicy
public void setMaxTextMessageSize(int size)
{
assertPositive("MaxTextMessageSize",size);
- assertGreaterThan("MaxTextMessageSize",size,"MaxTextMessageBufferSize",maxTextMessageBufferSize);
this.maxTextMessageSize = size;
}

Back to the top