public class WebSocketPolicy
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private class |
WebSocketPolicy.Delegated
Allows Behavior to be changed, but the settings to delegated.
|
Modifier and Type | Field and Description |
---|---|
private long |
asyncWriteTimeout
The timeout in ms (milliseconds) for async write operations.
|
private WebSocketBehavior |
behavior
Behavior of the websockets
|
private long |
idleTimeout
The time in ms (milliseconds) that a websocket may be idle before closing.
|
private int |
inputBufferSize
The size of the input (read from network layer) buffer size.
|
private static int |
KB |
private int |
maxBinaryMessageBufferSize
The maximum size of a binary message buffer
|
private int |
maxBinaryMessageSize
The maximum size of a binary message during parsing/generating.
|
private int |
maxTextMessageBufferSize
The maximum size of a text message buffer.
|
private int |
maxTextMessageSize
The maximum size of a text message during parsing/generating.
|
Constructor and Description |
---|
WebSocketPolicy(WebSocketBehavior behavior) |
Modifier and Type | Method and Description |
---|---|
private void |
assertGreaterThan(java.lang.String name,
long size,
long minSize) |
private void |
assertLessThan(java.lang.String name,
long size,
java.lang.String otherName,
long otherSize) |
void |
assertValidBinaryMessageSize(int requestedSize) |
void |
assertValidTextMessageSize(int requestedSize) |
WebSocketPolicy |
clonePolicy()
Make a copy of the policy, with current values.
|
WebSocketPolicy |
clonePolicy(WebSocketBehavior behavior)
Deprecated.
use
delegateAs(WebSocketBehavior) instead |
WebSocketPolicy |
delegateAs(WebSocketBehavior behavior) |
long |
getAsyncWriteTimeout()
The timeout in ms (milliseconds) for async write operations.
|
WebSocketBehavior |
getBehavior() |
long |
getIdleTimeout()
The time in ms (milliseconds) that a websocket connection may be idle before being closed automatically.
|
int |
getInputBufferSize()
The size of the input (read from network layer) buffer size.
|
int |
getMaxBinaryMessageBufferSize()
Get the maximum size of a binary message buffer (for streaming writing)
|
int |
getMaxBinaryMessageSize()
Get the maximum size of a binary message during parsing.
|
int |
getMaxTextMessageBufferSize()
Get the maximum size of a text message buffer (for streaming writing)
|
int |
getMaxTextMessageSize()
Get the maximum size of a text message during parsing.
|
static WebSocketPolicy |
newClientPolicy() |
static WebSocketPolicy |
newServerPolicy() |
void |
setAsyncWriteTimeout(long ms)
The timeout in ms (milliseconds) for async write operations.
|
void |
setIdleTimeout(long ms)
The time in ms (milliseconds) that a websocket may be idle before closing.
|
void |
setInputBufferSize(int size)
The size of the input (read from network layer) buffer size.
|
void |
setMaxBinaryMessageBufferSize(int size)
The maximum size of a binary message buffer.
|
void |
setMaxBinaryMessageSize(int size)
The maximum size of a binary message during parsing.
|
void |
setMaxTextMessageBufferSize(int size)
The maximum size of a text message buffer.
|
void |
setMaxTextMessageSize(int size)
The maximum size of a text message during parsing.
|
java.lang.String |
toString() |
private static final int KB
private int maxTextMessageSize
Text messages over this maximum will result in a close code 1009 StatusCode.MESSAGE_TOO_LARGE
Default: 65536 (64 K)
private int maxTextMessageBufferSize
Used ONLY for stream based message writing.
Default: 32768 (32 K)
private int maxBinaryMessageSize
Binary messages over this maximum will result in a close code 1009 StatusCode.MESSAGE_TOO_LARGE
Default: 65536 (64 K)
private int maxBinaryMessageBufferSize
Used ONLY for for stream based message writing
Default: 32768 (32 K)
private long asyncWriteTimeout
Negative values indicate a disabled timeout.
private long idleTimeout
Default: 300000 (ms)
private int inputBufferSize
Default: 4096 (4 K)
private final WebSocketBehavior behavior
public WebSocketPolicy(WebSocketBehavior behavior)
public static WebSocketPolicy newClientPolicy()
public static WebSocketPolicy newServerPolicy()
private void assertLessThan(java.lang.String name, long size, java.lang.String otherName, long otherSize)
private void assertGreaterThan(java.lang.String name, long size, long minSize)
public void assertValidBinaryMessageSize(int requestedSize)
public void assertValidTextMessageSize(int requestedSize)
public WebSocketPolicy clonePolicy()
@Deprecated public WebSocketPolicy clonePolicy(WebSocketBehavior behavior)
delegateAs(WebSocketBehavior)
insteadbehavior
- the behavior to copy/clonepublic WebSocketPolicy delegateAs(WebSocketBehavior behavior)
public long getAsyncWriteTimeout()
Negative values indicate a disabled timeout.
public WebSocketBehavior getBehavior()
public long getIdleTimeout()
public int getInputBufferSize()
This is the raw read operation buffer size, before the parsing of the websocket frames.
public int getMaxBinaryMessageBufferSize()
public int getMaxBinaryMessageSize()
This is a memory conservation option, memory over this limit will not be allocated by Jetty for handling binary messages. This applies to individual frames, whole message handling, and partial message handling.
Binary messages over this maximum will result in a close code 1009 StatusCode.MESSAGE_TOO_LARGE
public int getMaxTextMessageBufferSize()
public int getMaxTextMessageSize()
This is a memory conservation option, memory over this limit will not be allocated by Jetty for handling text messages. This applies to individual frames, whole message handling, and partial message handling.
Text messages over this maximum will result in a close code 1009 StatusCode.MESSAGE_TOO_LARGE
public void setAsyncWriteTimeout(long ms)
Negative values indicate a disabled timeout.
ms
- the timeout in millisecondspublic void setIdleTimeout(long ms)
ms
- the timeout in millisecondspublic void setInputBufferSize(int size)
size
- the size in bytespublic void setMaxBinaryMessageBufferSize(int size)
Used ONLY for stream based binary message writing.
size
- the maximum size of the binary message bufferpublic void setMaxBinaryMessageSize(int size)
This is a memory conservation option, memory over this limit will not be allocated by Jetty for handling binary messages. This applies to individual frames, whole message handling, and partial message handling.
Binary messages over this maximum will result in a close code 1009 StatusCode.MESSAGE_TOO_LARGE
size
- the maximum allowed size of a binary message.public void setMaxTextMessageBufferSize(int size)
Used ONLY for stream based text message writing.
size
- the maximum size of the text message bufferpublic void setMaxTextMessageSize(int size)
This is a memory conservation option, memory over this limit will not be allocated by Jetty for handling text messages. This applies to individual frames, whole message handling, and partial message handling.
Text messages over this maximum will result in a close code 1009 StatusCode.MESSAGE_TOO_LARGE
size
- the maximum allowed size of a text message.public java.lang.String toString()
toString
in class java.lang.Object