private class WebSocketPolicy.Delegated extends WebSocketPolicy
This rears its ugly head when a JSR356 Server Container is used as a JSR356 Client Container. The JSR356 Server Container is Behavior SERVER, but its container level Policy is shared with the JSR356 Client Container as well. This allows a delegate to the policy with a different behavior.
Modifier and Type | Field and Description |
---|---|
private WebSocketPolicy |
delegated |
Constructor and Description |
---|
Delegated(WebSocketPolicy policy,
WebSocketBehavior behavior) |
Modifier and Type | Method and Description |
---|---|
void |
assertValidBinaryMessageSize(int requestedSize) |
void |
assertValidTextMessageSize(int requestedSize) |
WebSocketPolicy |
clonePolicy()
Make a copy of the policy, with current values.
|
WebSocketPolicy |
clonePolicy(WebSocketBehavior behavior)
Make a copy of the policy, with current values, but a different behavior.
|
WebSocketPolicy |
delegateAs(WebSocketBehavior behavior) |
long |
getAsyncWriteTimeout()
The timeout in ms (milliseconds) for async write operations.
|
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.
|
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.
|
getBehavior, newClientPolicy, newServerPolicy, toString
private final WebSocketPolicy delegated
public Delegated(WebSocketPolicy policy, WebSocketBehavior behavior)
public void assertValidBinaryMessageSize(int requestedSize)
assertValidBinaryMessageSize
in class WebSocketPolicy
public void assertValidTextMessageSize(int requestedSize)
assertValidTextMessageSize
in class WebSocketPolicy
public WebSocketPolicy clonePolicy()
WebSocketPolicy
clonePolicy
in class WebSocketPolicy
public WebSocketPolicy clonePolicy(WebSocketBehavior behavior)
WebSocketPolicy
clonePolicy
in class WebSocketPolicy
behavior
- the behavior to copy/clonepublic WebSocketPolicy delegateAs(WebSocketBehavior behavior)
delegateAs
in class WebSocketPolicy
public long getAsyncWriteTimeout()
WebSocketPolicy
Negative values indicate a disabled timeout.
getAsyncWriteTimeout
in class WebSocketPolicy
public long getIdleTimeout()
WebSocketPolicy
getIdleTimeout
in class WebSocketPolicy
public int getInputBufferSize()
WebSocketPolicy
This is the raw read operation buffer size, before the parsing of the websocket frames.
getInputBufferSize
in class WebSocketPolicy
public int getMaxBinaryMessageBufferSize()
WebSocketPolicy
getMaxBinaryMessageBufferSize
in class WebSocketPolicy
public int getMaxBinaryMessageSize()
WebSocketPolicy
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
getMaxBinaryMessageSize
in class WebSocketPolicy
public int getMaxTextMessageBufferSize()
WebSocketPolicy
getMaxTextMessageBufferSize
in class WebSocketPolicy
public int getMaxTextMessageSize()
WebSocketPolicy
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
getMaxTextMessageSize
in class WebSocketPolicy
public void setAsyncWriteTimeout(long ms)
WebSocketPolicy
Negative values indicate a disabled timeout.
setAsyncWriteTimeout
in class WebSocketPolicy
ms
- the timeout in millisecondspublic void setIdleTimeout(long ms)
WebSocketPolicy
setIdleTimeout
in class WebSocketPolicy
ms
- the timeout in millisecondspublic void setInputBufferSize(int size)
WebSocketPolicy
setInputBufferSize
in class WebSocketPolicy
size
- the size in bytespublic void setMaxBinaryMessageBufferSize(int size)
WebSocketPolicy
Used ONLY for stream based binary message writing.
setMaxBinaryMessageBufferSize
in class WebSocketPolicy
size
- the maximum size of the binary message bufferpublic void setMaxBinaryMessageSize(int size)
WebSocketPolicy
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
setMaxBinaryMessageSize
in class WebSocketPolicy
size
- the maximum allowed size of a binary message.public void setMaxTextMessageBufferSize(int size)
WebSocketPolicy
Used ONLY for stream based text message writing.
setMaxTextMessageBufferSize
in class WebSocketPolicy
size
- the maximum size of the text message bufferpublic void setMaxTextMessageSize(int size)
WebSocketPolicy
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
setMaxTextMessageSize
in class WebSocketPolicy
size
- the maximum allowed size of a text message.