Class WebSocketPolicy.Delegated
- java.lang.Object
-
- org.eclipse.jetty.websocket.api.WebSocketPolicy
-
- org.eclipse.jetty.websocket.api.WebSocketPolicy.Delegated
-
- Enclosing class:
- WebSocketPolicy
private class WebSocketPolicy.Delegated extends WebSocketPolicy
Allows Behavior to be changed, but the settings to delegated.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.
-
-
Field Summary
Fields Modifier and Type Field Description private WebSocketPolicy
delegated
-
Constructor Summary
Constructors Constructor Description Delegated(WebSocketPolicy policy, WebSocketBehavior behavior)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class org.eclipse.jetty.websocket.api.WebSocketPolicy
getBehavior, newClientPolicy, newServerPolicy, toString
-
-
-
-
Field Detail
-
delegated
private final WebSocketPolicy delegated
-
-
Constructor Detail
-
Delegated
public Delegated(WebSocketPolicy policy, WebSocketBehavior behavior)
-
-
Method Detail
-
assertValidBinaryMessageSize
public void assertValidBinaryMessageSize(int requestedSize)
- Overrides:
assertValidBinaryMessageSize
in classWebSocketPolicy
-
assertValidTextMessageSize
public void assertValidTextMessageSize(int requestedSize)
- Overrides:
assertValidTextMessageSize
in classWebSocketPolicy
-
clonePolicy
public WebSocketPolicy clonePolicy()
Description copied from class:WebSocketPolicy
Make a copy of the policy, with current values.- Overrides:
clonePolicy
in classWebSocketPolicy
- Returns:
- the cloned copy of the policy.
-
clonePolicy
public WebSocketPolicy clonePolicy(WebSocketBehavior behavior)
Description copied from class:WebSocketPolicy
Make a copy of the policy, with current values, but a different behavior.- Overrides:
clonePolicy
in classWebSocketPolicy
- Parameters:
behavior
- the behavior to copy/clone- Returns:
- the cloned policy with a new behavior.
-
delegateAs
public WebSocketPolicy delegateAs(WebSocketBehavior behavior)
- Overrides:
delegateAs
in classWebSocketPolicy
-
getAsyncWriteTimeout
public long getAsyncWriteTimeout()
Description copied from class:WebSocketPolicy
The timeout in ms (milliseconds) for async write operations.Negative values indicate a disabled timeout.
- Overrides:
getAsyncWriteTimeout
in classWebSocketPolicy
- Returns:
- the timeout for async write operations. negative values indicate disabled timeout.
-
getIdleTimeout
public long getIdleTimeout()
Description copied from class:WebSocketPolicy
The time in ms (milliseconds) that a websocket connection may be idle before being closed automatically.- Overrides:
getIdleTimeout
in classWebSocketPolicy
- Returns:
- the timeout in milliseconds for idle timeout.
-
getInputBufferSize
public int getInputBufferSize()
Description copied from class:WebSocketPolicy
The size of the input (read from network layer) buffer size.This is the raw read operation buffer size, before the parsing of the websocket frames.
- Overrides:
getInputBufferSize
in classWebSocketPolicy
- Returns:
- the raw network bytes read operation buffer size.
-
getMaxBinaryMessageBufferSize
public int getMaxBinaryMessageBufferSize()
Description copied from class:WebSocketPolicy
Get the maximum size of a binary message buffer (for streaming writing)- Overrides:
getMaxBinaryMessageBufferSize
in classWebSocketPolicy
- Returns:
- the maximum size of a binary message buffer
-
getMaxBinaryMessageSize
public int getMaxBinaryMessageSize()
Description copied from class:WebSocketPolicy
Get the maximum size of a binary message during parsing.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
- Overrides:
getMaxBinaryMessageSize
in classWebSocketPolicy
- Returns:
- the maximum size of a binary message
-
getMaxTextMessageBufferSize
public int getMaxTextMessageBufferSize()
Description copied from class:WebSocketPolicy
Get the maximum size of a text message buffer (for streaming writing)- Overrides:
getMaxTextMessageBufferSize
in classWebSocketPolicy
- Returns:
- the maximum size of a text message buffer
-
getMaxTextMessageSize
public int getMaxTextMessageSize()
Description copied from class:WebSocketPolicy
Get the maximum size of a text message during parsing.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
- Overrides:
getMaxTextMessageSize
in classWebSocketPolicy
- Returns:
- the maximum size of a text message.
-
setAsyncWriteTimeout
public void setAsyncWriteTimeout(long ms)
Description copied from class:WebSocketPolicy
The timeout in ms (milliseconds) for async write operations.Negative values indicate a disabled timeout.
- Overrides:
setAsyncWriteTimeout
in classWebSocketPolicy
- Parameters:
ms
- the timeout in milliseconds
-
setIdleTimeout
public void setIdleTimeout(long ms)
Description copied from class:WebSocketPolicy
The time in ms (milliseconds) that a websocket may be idle before closing.- Overrides:
setIdleTimeout
in classWebSocketPolicy
- Parameters:
ms
- the timeout in milliseconds
-
setInputBufferSize
public void setInputBufferSize(int size)
Description copied from class:WebSocketPolicy
The size of the input (read from network layer) buffer size.- Overrides:
setInputBufferSize
in classWebSocketPolicy
- Parameters:
size
- the size in bytes
-
setMaxBinaryMessageBufferSize
public void setMaxBinaryMessageBufferSize(int size)
Description copied from class:WebSocketPolicy
The maximum size of a binary message buffer.Used ONLY for stream based binary message writing.
- Overrides:
setMaxBinaryMessageBufferSize
in classWebSocketPolicy
- Parameters:
size
- the maximum size of the binary message buffer
-
setMaxBinaryMessageSize
public void setMaxBinaryMessageSize(int size)
Description copied from class:WebSocketPolicy
The maximum size of a binary message during parsing.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
- Overrides:
setMaxBinaryMessageSize
in classWebSocketPolicy
- Parameters:
size
- the maximum allowed size of a binary message.
-
setMaxTextMessageBufferSize
public void setMaxTextMessageBufferSize(int size)
Description copied from class:WebSocketPolicy
The maximum size of a text message buffer.Used ONLY for stream based text message writing.
- Overrides:
setMaxTextMessageBufferSize
in classWebSocketPolicy
- Parameters:
size
- the maximum size of the text message buffer
-
setMaxTextMessageSize
public void setMaxTextMessageSize(int size)
Description copied from class:WebSocketPolicy
The maximum size of a text message during parsing.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
- Overrides:
setMaxTextMessageSize
in classWebSocketPolicy
- Parameters:
size
- the maximum allowed size of a text message.
-
-