Add constructors and Javadoc comments to improve clarity and completeness across server components, including WebSocket and routing classes.
This commit is contained in:
@@ -80,6 +80,8 @@ public final class WebSocketConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum size of a single WebSocket frame payload.
|
||||
*
|
||||
* @return the maximum single-frame payload size in bytes
|
||||
*/
|
||||
public int maxFramePayloadLength() {
|
||||
@@ -87,6 +89,8 @@ public final class WebSocketConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum size of an aggregated (multi-frame) message.
|
||||
*
|
||||
* @return the maximum aggregated message size in bytes
|
||||
*/
|
||||
public int maxAggregatedMessageSize() {
|
||||
@@ -94,6 +98,8 @@ public final class WebSocketConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the idle timeout after which inactive connections are closed.
|
||||
*
|
||||
* @return the idle timeout, or {@code null} if idle connections are never closed
|
||||
*/
|
||||
public Duration idleTimeout() {
|
||||
@@ -101,6 +107,8 @@ public final class WebSocketConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether connections from any origin are accepted.
|
||||
*
|
||||
* @return {@code true} if connections from any origin are accepted
|
||||
*/
|
||||
public boolean allowAnyOrigin() {
|
||||
@@ -108,6 +116,8 @@ public final class WebSocketConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the explicitly allowed origins.
|
||||
*
|
||||
* @return the immutable set of explicitly allowed origins
|
||||
*/
|
||||
public Set<String> allowedOrigins() {
|
||||
@@ -126,6 +136,8 @@ public final class WebSocketConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether per-message deflate compression is enabled.
|
||||
*
|
||||
* @return {@code true} if per-message compression is enabled
|
||||
*/
|
||||
public boolean compression() {
|
||||
@@ -133,6 +145,8 @@ public final class WebSocketConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the WebSocket path is matched by prefix rather than exact equality.
|
||||
*
|
||||
* @return {@code true} if the WebSocket path is matched by prefix rather than exactly
|
||||
*/
|
||||
public boolean checkStartsWith() {
|
||||
@@ -162,6 +176,13 @@ public final class WebSocketConfig {
|
||||
/** Whether path matching uses a prefix check; defaults to {@code false}. */
|
||||
private boolean checkStartsWith = false;
|
||||
|
||||
/**
|
||||
* Creates a builder pre-populated with the default configuration values described
|
||||
* above. Obtain instances via {@link WebSocketConfig#builder()}.
|
||||
*/
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum single-frame payload size.
|
||||
*
|
||||
|
||||
@@ -42,6 +42,8 @@ public final class WebSocketGroup {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of this group.
|
||||
*
|
||||
* @return the group name
|
||||
*/
|
||||
public String name() {
|
||||
@@ -71,6 +73,8 @@ public final class WebSocketGroup {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns how many connections are currently in the group.
|
||||
*
|
||||
* @return the current number of member connections
|
||||
*/
|
||||
public int size() {
|
||||
|
||||
@@ -19,6 +19,12 @@ public final class WebSocketRouter {
|
||||
/** Root of the routing trie. */
|
||||
private final Node root = new Node();
|
||||
|
||||
/**
|
||||
* Creates an empty WebSocket router with no registered handlers.
|
||||
*/
|
||||
public WebSocketRouter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a handler at the given path, creating any missing trie nodes. Segments wrapped
|
||||
* in braces (e.g. {@code /chat/{room}}) are treated as path parameters.
|
||||
|
||||
@@ -66,6 +66,8 @@ public final class WebSocketSession {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the unique identifier generated for this session.
|
||||
*
|
||||
* @return the unique session id
|
||||
*/
|
||||
public String id() {
|
||||
@@ -73,6 +75,8 @@ public final class WebSocketSession {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path the connection was established on.
|
||||
*
|
||||
* @return the path the connection was established on
|
||||
*/
|
||||
public String path() {
|
||||
@@ -90,6 +94,8 @@ public final class WebSocketSession {
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the connection is still open.
|
||||
*
|
||||
* @return {@code true} if the underlying channel is still active (open)
|
||||
*/
|
||||
public boolean isOpen() {
|
||||
@@ -111,6 +117,8 @@ public final class WebSocketSession {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the underlying Netty channel for advanced, low-level use.
|
||||
*
|
||||
* @return the underlying Netty channel, for advanced use
|
||||
*/
|
||||
public Channel channel() {
|
||||
|
||||
Reference in New Issue
Block a user