You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/04/14 09:57:08 UTC
[tomcat] 05/10: Code clean-up - no functional change
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 847ed3ace330695d1c3c99de959d05563326aed2
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Apr 13 17:11:48 2023 +0100
Code clean-up - no functional change
---
java/jakarta/websocket/ClientEndpoint.java | 6 +-
java/jakarta/websocket/ClientEndpointConfig.java | 31 ++--
java/jakarta/websocket/CloseReason.java | 6 +-
java/jakarta/websocket/ContainerProvider.java | 15 +-
java/jakarta/websocket/DecodeException.java | 3 +-
.../websocket/DefaultClientEndpointConfig.java | 9 +-
java/jakarta/websocket/Encoder.java | 6 +-
java/jakarta/websocket/Endpoint.java | 9 +-
java/jakarta/websocket/Extension.java | 2 +
java/jakarta/websocket/MessageHandler.java | 7 +-
java/jakarta/websocket/PongMessage.java | 6 +-
java/jakarta/websocket/RemoteEndpoint.java | 186 ++++++++++-----------
java/jakarta/websocket/SendResult.java | 2 +-
java/jakarta/websocket/Session.java | 93 +++++------
java/jakarta/websocket/WebSocketContainer.java | 70 ++++----
.../server/DefaultServerEndpointConfig.java | 11 +-
.../jakarta/websocket/server/HandshakeRequest.java | 12 +-
java/jakarta/websocket/server/PathParam.java | 5 +-
.../websocket/server/ServerApplicationConfig.java | 27 ++-
java/jakarta/websocket/server/ServerContainer.java | 27 +--
java/jakarta/websocket/server/ServerEndpoint.java | 7 +-
.../websocket/server/ServerEndpointConfig.java | 66 +++-----
22 files changed, 271 insertions(+), 335 deletions(-)
diff --git a/java/jakarta/websocket/ClientEndpoint.java b/java/jakarta/websocket/ClientEndpoint.java
index fb19ad0cd1..acaa160cc8 100644
--- a/java/jakarta/websocket/ClientEndpoint.java
+++ b/java/jakarta/websocket/ClientEndpoint.java
@@ -27,8 +27,10 @@ import jakarta.websocket.ClientEndpointConfig.Configurator;
@Target(ElementType.TYPE)
public @interface ClientEndpoint {
String[] subprotocols() default {};
+
Class<? extends Decoder>[] decoders() default {};
+
Class<? extends Encoder>[] encoders() default {};
- Class<? extends Configurator> configurator()
- default Configurator.class;
+
+ Class<? extends Configurator> configurator() default Configurator.class;
}
diff --git a/java/jakarta/websocket/ClientEndpointConfig.java b/java/jakarta/websocket/ClientEndpointConfig.java
index e74d4675f9..ce3caba85e 100644
--- a/java/jakarta/websocket/ClientEndpointConfig.java
+++ b/java/jakarta/websocket/ClientEndpointConfig.java
@@ -34,8 +34,8 @@ public interface ClientEndpointConfig extends EndpointConfig {
final class Builder {
- private static final Configurator DEFAULT_CONFIGURATOR =
- new Configurator() {};
+ private static final Configurator DEFAULT_CONFIGURATOR = new Configurator() {
+ };
public static Builder create() {
@@ -55,8 +55,8 @@ public interface ClientEndpointConfig extends EndpointConfig {
private SSLContext sslContext = null;
public ClientEndpointConfig build() {
- return new DefaultClientEndpointConfig(preferredSubprotocols,
- extensions, encoders, decoders, sslContext, configurator);
+ return new DefaultClientEndpointConfig(preferredSubprotocols, extensions, encoders, decoders, sslContext,
+ configurator);
}
@@ -70,21 +70,17 @@ public interface ClientEndpointConfig extends EndpointConfig {
}
- public Builder preferredSubprotocols(
- List<String> preferredSubprotocols) {
- if (preferredSubprotocols == null ||
- preferredSubprotocols.size() == 0) {
+ public Builder preferredSubprotocols(List<String> preferredSubprotocols) {
+ if (preferredSubprotocols == null || preferredSubprotocols.size() == 0) {
this.preferredSubprotocols = Collections.emptyList();
} else {
- this.preferredSubprotocols =
- Collections.unmodifiableList(preferredSubprotocols);
+ this.preferredSubprotocols = Collections.unmodifiableList(preferredSubprotocols);
}
return this;
}
- public Builder extensions(
- List<Extension> extensions) {
+ public Builder extensions(List<Extension> extensions) {
if (extensions == null || extensions.size() == 0) {
this.extensions = Collections.emptyList();
} else {
@@ -124,18 +120,17 @@ public interface ClientEndpointConfig extends EndpointConfig {
class Configurator {
/**
- * Provides the client with a mechanism to inspect and/or modify the headers
- * that are sent to the server to start the WebSocket handshake.
+ * Provides the client with a mechanism to inspect and/or modify the headers that are sent to the server to
+ * start the WebSocket handshake.
*
- * @param headers The HTTP headers
+ * @param headers The HTTP headers
*/
- public void beforeRequest(Map<String, List<String>> headers) {
+ public void beforeRequest(Map<String,List<String>> headers) {
// NO-OP
}
/**
- * Provides the client with a mechanism to inspect the handshake response
- * that is returned from the server.
+ * Provides the client with a mechanism to inspect the handshake response that is returned from the server.
*
* @param handshakeResponse The response
*/
diff --git a/java/jakarta/websocket/CloseReason.java b/java/jakarta/websocket/CloseReason.java
index dae0777ac1..97e9b5d8a3 100644
--- a/java/jakarta/websocket/CloseReason.java
+++ b/java/jakarta/websocket/CloseReason.java
@@ -36,8 +36,7 @@ public class CloseReason {
@Override
public String toString() {
- return "CloseReason: code [" + closeCode.getCode() +
- "], reason [" + reasonPhrase + "]";
+ return "CloseReason: code [" + closeCode.getCode() + "], reason [" + reasonPhrase + "]";
}
public interface CloseCode {
@@ -109,8 +108,7 @@ public class CloseReason {
case 1015:
return CloseCodes.TLS_HANDSHAKE_FAILURE;
default:
- throw new IllegalArgumentException(
- "Invalid close code: [" + code + "]");
+ throw new IllegalArgumentException("Invalid close code: [" + code + "]");
}
}
diff --git a/java/jakarta/websocket/ContainerProvider.java b/java/jakarta/websocket/ContainerProvider.java
index 33a8af2879..8069d89f41 100644
--- a/java/jakarta/websocket/ContainerProvider.java
+++ b/java/jakarta/websocket/ContainerProvider.java
@@ -20,13 +20,11 @@ import java.util.Iterator;
import java.util.ServiceLoader;
/**
- * Use the {@link ServiceLoader} mechanism to provide instances of the WebSocket
- * client container.
+ * Use the {@link ServiceLoader} mechanism to provide instances of the WebSocket client container.
*/
public abstract class ContainerProvider {
- private static final String DEFAULT_PROVIDER_CLASS_NAME =
- "org.apache.tomcat.websocket.WsWebSocketContainer";
+ private static final String DEFAULT_PROVIDER_CLASS_NAME = "org.apache.tomcat.websocket.WsWebSocketContainer";
/**
* Create a new container used to create outgoing WebSocket connections.
@@ -36,8 +34,7 @@ public abstract class ContainerProvider {
public static WebSocketContainer getWebSocketContainer() {
WebSocketContainer result = null;
- ServiceLoader<ContainerProvider> serviceLoader =
- ServiceLoader.load(ContainerProvider.class);
+ ServiceLoader<ContainerProvider> serviceLoader = ServiceLoader.load(ContainerProvider.class);
Iterator<ContainerProvider> iter = serviceLoader.iterator();
while (result == null && iter.hasNext()) {
result = iter.next().getContainer();
@@ -48,11 +45,9 @@ public abstract class ContainerProvider {
try {
@SuppressWarnings("unchecked")
Class<WebSocketContainer> clazz =
- (Class<WebSocketContainer>) Class.forName(
- DEFAULT_PROVIDER_CLASS_NAME);
+ (Class<WebSocketContainer>) Class.forName(DEFAULT_PROVIDER_CLASS_NAME);
result = clazz.getConstructor().newInstance();
- } catch (ReflectiveOperationException | IllegalArgumentException |
- SecurityException e) {
+ } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) {
// No options left. Just return null.
}
}
diff --git a/java/jakarta/websocket/DecodeException.java b/java/jakarta/websocket/DecodeException.java
index 6076e903ae..1fc3159c23 100644
--- a/java/jakarta/websocket/DecodeException.java
+++ b/java/jakarta/websocket/DecodeException.java
@@ -30,8 +30,7 @@ public class DecodeException extends Exception {
this.bb = bb;
}
- public DecodeException(String encodedString, String message,
- Throwable cause) {
+ public DecodeException(String encodedString, String message, Throwable cause) {
super(message, cause);
this.encodedString = encodedString;
}
diff --git a/java/jakarta/websocket/DefaultClientEndpointConfig.java b/java/jakarta/websocket/DefaultClientEndpointConfig.java
index 456c0d613f..71a1b9bb04 100644
--- a/java/jakarta/websocket/DefaultClientEndpointConfig.java
+++ b/java/jakarta/websocket/DefaultClientEndpointConfig.java
@@ -33,11 +33,8 @@ final class DefaultClientEndpointConfig implements ClientEndpointConfig {
private final Configurator configurator;
- DefaultClientEndpointConfig(List<String> preferredSubprotocols,
- List<Extension> extensions,
- List<Class<? extends Encoder>> encoders,
- List<Class<? extends Decoder>> decoders,
- SSLContext sslContext,
+ DefaultClientEndpointConfig(List<String> preferredSubprotocols, List<Extension> extensions,
+ List<Class<? extends Encoder>> encoders, List<Class<? extends Decoder>> decoders, SSLContext sslContext,
Configurator configurator) {
this.preferredSubprotocols = preferredSubprotocols;
this.extensions = extensions;
@@ -79,7 +76,7 @@ final class DefaultClientEndpointConfig implements ClientEndpointConfig {
@Override
- public Map<String, Object> getUserProperties() {
+ public Map<String,Object> getUserProperties() {
return userProperties;
}
diff --git a/java/jakarta/websocket/Encoder.java b/java/jakarta/websocket/Encoder.java
index c201ae98b0..808cf3d79b 100644
--- a/java/jakarta/websocket/Encoder.java
+++ b/java/jakarta/websocket/Encoder.java
@@ -44,8 +44,7 @@ public interface Encoder {
interface TextStream<T> extends Encoder {
- void encode(T object, Writer writer)
- throws EncodeException, IOException;
+ void encode(T object, Writer writer) throws EncodeException, IOException;
}
interface Binary<T> extends Encoder {
@@ -55,7 +54,6 @@ public interface Encoder {
interface BinaryStream<T> extends Encoder {
- void encode(T object, OutputStream os)
- throws EncodeException, IOException;
+ void encode(T object, OutputStream os) throws EncodeException, IOException;
}
}
diff --git a/java/jakarta/websocket/Endpoint.java b/java/jakarta/websocket/Endpoint.java
index 7a33a24074..059430d25e 100644
--- a/java/jakarta/websocket/Endpoint.java
+++ b/java/jakarta/websocket/Endpoint.java
@@ -21,17 +21,16 @@ public abstract class Endpoint {
/**
* Event that is triggered when a new session starts.
*
- * @param session The new session.
- * @param config The configuration with which the Endpoint was
- * configured.
+ * @param session The new session.
+ * @param config The configuration with which the Endpoint was configured.
*/
public abstract void onOpen(Session session, EndpointConfig config);
/**
* Event that is triggered when a session has closed.
*
- * @param session The session
- * @param closeReason Why the session was closed
+ * @param session The session
+ * @param closeReason Why the session was closed
*/
public void onClose(Session session, CloseReason closeReason) {
// NO-OP by default
diff --git a/java/jakarta/websocket/Extension.java b/java/jakarta/websocket/Extension.java
index 98734b328a..a4cbca8f62 100644
--- a/java/jakarta/websocket/Extension.java
+++ b/java/jakarta/websocket/Extension.java
@@ -20,10 +20,12 @@ import java.util.List;
public interface Extension {
String getName();
+
List<Parameter> getParameters();
interface Parameter {
String getName();
+
String getValue();
}
}
diff --git a/java/jakarta/websocket/MessageHandler.java b/java/jakarta/websocket/MessageHandler.java
index 212ec0ead9..748dd76776 100644
--- a/java/jakarta/websocket/MessageHandler.java
+++ b/java/jakarta/websocket/MessageHandler.java
@@ -23,9 +23,8 @@ public interface MessageHandler {
/**
* Called when part of a message is available to be processed.
*
- * @param messagePart The message part
- * @param last <code>true</code> if this is the last part of
- * this message, else <code>false</code>
+ * @param messagePart The message part
+ * @param last <code>true</code> if this is the last part of this message, else <code>false</code>
*/
void onMessage(T messagePart, boolean last);
}
@@ -35,7 +34,7 @@ public interface MessageHandler {
/**
* Called when a whole message is available to be processed.
*
- * @param message The message
+ * @param message The message
*/
void onMessage(T message);
}
diff --git a/java/jakarta/websocket/PongMessage.java b/java/jakarta/websocket/PongMessage.java
index 8740eae8e4..ae77048fb5 100644
--- a/java/jakarta/websocket/PongMessage.java
+++ b/java/jakarta/websocket/PongMessage.java
@@ -19,14 +19,14 @@ package jakarta.websocket;
import java.nio.ByteBuffer;
/**
- * Represents a WebSocket Pong message and used by message handlers to enable
- * applications to process the response to any Pings they send.
+ * Represents a WebSocket Pong message and used by message handlers to enable applications to process the response to
+ * any Pings they send.
*/
public interface PongMessage {
/**
* Get the payload of the Pong message.
*
- * @return The payload of the Pong message.
+ * @return The payload of the Pong message.
*/
ByteBuffer getApplicationData();
}
diff --git a/java/jakarta/websocket/RemoteEndpoint.java b/java/jakarta/websocket/RemoteEndpoint.java
index 213b8a4104..9826d98cc0 100644
--- a/java/jakarta/websocket/RemoteEndpoint.java
+++ b/java/jakarta/websocket/RemoteEndpoint.java
@@ -28,78 +28,82 @@ public interface RemoteEndpoint {
interface Async extends RemoteEndpoint {
/**
- * Obtain the timeout (in milliseconds) for sending a message
- * asynchronously. The default value is determined by
+ * Obtain the timeout (in milliseconds) for sending a message asynchronously. The default value is determined by
* {@link WebSocketContainer#getDefaultAsyncSendTimeout()}.
- * @return The current send timeout in milliseconds. A non-positive
- * value means an infinite timeout.
+ *
+ * @return The current send timeout in milliseconds. A non-positive value means an infinite timeout.
*/
long getSendTimeout();
/**
- * Set the timeout (in milliseconds) for sending a message
- * asynchronously. The default value is determined by
+ * Set the timeout (in milliseconds) for sending a message asynchronously. The default value is determined by
* {@link WebSocketContainer#getDefaultAsyncSendTimeout()}.
- * @param timeout The new timeout for sending messages asynchronously
- * in milliseconds. A non-positive value means an
- * infinite timeout.
+ *
+ * @param timeout The new timeout for sending messages asynchronously in milliseconds. A non-positive value
+ * means an infinite timeout.
*/
void setSendTimeout(long timeout);
/**
- * Send the message asynchronously, using the SendHandler to signal to the
- * client when the message has been sent.
- * @param text The text message to send
- * @param completion Used to signal to the client when the message has
- * been sent
+ * Send the message asynchronously, using the SendHandler to signal to the client when the message has been
+ * sent.
+ *
+ * @param text The text message to send
+ * @param completion Used to signal to the client when the message has been sent
*/
void sendText(String text, SendHandler completion);
/**
- * Send the message asynchronously, using the Future to signal to the
- * client when the message has been sent.
- * @param text The text message to send
+ * Send the message asynchronously, using the Future to signal to the client when the message has been sent.
+ *
+ * @param text The text message to send
+ *
* @return A Future that signals when the message has been sent.
*/
Future<Void> sendText(String text);
/**
- * Send the message asynchronously, using the Future to signal to the client
- * when the message has been sent.
- * @param data The text message to send
+ * Send the message asynchronously, using the Future to signal to the client when the message has been sent.
+ *
+ * @param data The text message to send
+ *
* @return A Future that signals when the message has been sent.
+ *
* @throws IllegalArgumentException if {@code data} is {@code null}.
*/
Future<Void> sendBinary(ByteBuffer data);
/**
- * Send the message asynchronously, using the SendHandler to signal to the
- * client when the message has been sent.
- * @param data The text message to send
- * @param completion Used to signal to the client when the message has
- * been sent
- * @throws IllegalArgumentException if {@code data} or {@code completion}
- * is {@code null}.
+ * Send the message asynchronously, using the SendHandler to signal to the client when the message has been
+ * sent.
+ *
+ * @param data The text message to send
+ * @param completion Used to signal to the client when the message has been sent
+ *
+ * @throws IllegalArgumentException if {@code data} or {@code completion} is {@code null}.
*/
void sendBinary(ByteBuffer data, SendHandler completion);
/**
- * Encodes object as a message and sends it asynchronously, using the
- * Future to signal to the client when the message has been sent.
- * @param obj The object to be sent.
+ * Encodes object as a message and sends it asynchronously, using the Future to signal to the client when the
+ * message has been sent.
+ *
+ * @param obj The object to be sent.
+ *
* @return A Future that signals when the message has been sent.
+ *
* @throws IllegalArgumentException if {@code obj} is {@code null}.
*/
Future<Void> sendObject(Object obj);
/**
- * Encodes object as a message and sends it asynchronously, using the
- * SendHandler to signal to the client when the message has been sent.
- * @param obj The object to be sent.
- * @param completion Used to signal to the client when the message has
- * been sent
- * @throws IllegalArgumentException if {@code obj} or
- * {@code completion} is {@code null}.
+ * Encodes object as a message and sends it asynchronously, using the SendHandler to signal to the client when
+ * the message has been sent.
+ *
+ * @param obj The object to be sent.
+ * @param completion Used to signal to the client when the message has been sent
+ *
+ * @throws IllegalArgumentException if {@code obj} or {@code completion} is {@code null}.
*/
void sendObject(Object obj, SendHandler completion);
@@ -109,48 +113,45 @@ public interface RemoteEndpoint {
/**
* Send the message, blocking until the message is sent.
- * @param text The text message to send.
+ *
+ * @param text The text message to send.
+ *
* @throws IllegalArgumentException if {@code text} is {@code null}.
- * @throws IOException if an I/O error occurs during the sending of the
- * message.
+ * @throws IOException if an I/O error occurs during the sending of the message.
*/
void sendText(String text) throws IOException;
/**
* Send the message, blocking until the message is sent.
- * @param data The binary message to send
+ *
+ * @param data The binary message to send
+ *
* @throws IllegalArgumentException if {@code data} is {@code null}.
- * @throws IOException if an I/O error occurs during the sending of the
- * message.
+ * @throws IOException if an I/O error occurs during the sending of the message.
*/
void sendBinary(ByteBuffer data) throws IOException;
/**
- * Sends part of a text message to the remote endpoint. Once the first part
- * of a message has been sent, no other text or binary messages may be sent
- * until all remaining parts of this message have been sent.
+ * Sends part of a text message to the remote endpoint. Once the first part of a message has been sent, no other
+ * text or binary messages may be sent until all remaining parts of this message have been sent.
+ *
+ * @param fragment The partial message to send
+ * @param isLast <code>true</code> if this is the last part of the message, otherwise <code>false</code>
*
- * @param fragment The partial message to send
- * @param isLast <code>true</code> if this is the last part of the
- * message, otherwise <code>false</code>
* @throws IllegalArgumentException if {@code fragment} is {@code null}.
- * @throws IOException if an I/O error occurs during the sending of the
- * message.
+ * @throws IOException if an I/O error occurs during the sending of the message.
*/
void sendText(String fragment, boolean isLast) throws IOException;
/**
- * Sends part of a binary message to the remote endpoint. Once the first
- * part of a message has been sent, no other text or binary messages may be
- * sent until all remaining parts of this message have been sent.
- *
- * @param partialByte The partial message to send
- * @param isLast <code>true</code> if this is the last part of the
- * message, otherwise <code>false</code>
- * @throws IllegalArgumentException if {@code partialByte} is
- * {@code null}.
- * @throws IOException if an I/O error occurs during the sending of the
- * message.
+ * Sends part of a binary message to the remote endpoint. Once the first part of a message has been sent, no
+ * other text or binary messages may be sent until all remaining parts of this message have been sent.
+ *
+ * @param partialByte The partial message to send
+ * @param isLast <code>true</code> if this is the last part of the message, otherwise <code>false</code>
+ *
+ * @throws IllegalArgumentException if {@code partialByte} is {@code null}.
+ * @throws IOException if an I/O error occurs during the sending of the message.
*/
void sendBinary(ByteBuffer partialByte, boolean isLast) throws IOException;
@@ -160,70 +161,63 @@ public interface RemoteEndpoint {
/**
* Encodes object as a message and sends it to the remote endpoint.
- * @param data The object to be sent.
- * @throws EncodeException if there was a problem encoding the
- * {@code data} object as a websocket message.
+ *
+ * @param data The object to be sent.
+ *
+ * @throws EncodeException if there was a problem encoding the {@code data} object as a websocket
+ * message.
* @throws IllegalArgumentException if {@code data} is {@code null}.
- * @throws IOException if an I/O error occurs during the sending of the
- * message.
+ * @throws IOException if an I/O error occurs during the sending of the message.
*/
void sendObject(Object data) throws IOException, EncodeException;
}
+
/**
- * Enable or disable the batching of outgoing messages for this endpoint. If
- * batching is disabled when it was previously enabled then this method will
- * block until any currently batched messages have been written.
+ * Enable or disable the batching of outgoing messages for this endpoint. If batching is disabled when it was
+ * previously enabled then this method will block until any currently batched messages have been written.
+ *
+ * @param batchingAllowed New setting
*
- * @param batchingAllowed New setting
- * @throws IOException If changing the value resulted in a call to
- * {@link #flushBatch()} and that call threw an
- * {@link IOException}.
+ * @throws IOException If changing the value resulted in a call to {@link #flushBatch()} and that call threw an
+ * {@link IOException}.
*/
void setBatchingAllowed(boolean batchingAllowed) throws IOException;
/**
* Obtains the current batching status of the endpoint.
*
- * @return <code>true</code> if batching is enabled, otherwise
- * <code>false</code>.
+ * @return <code>true</code> if batching is enabled, otherwise <code>false</code>.
*/
boolean getBatchingAllowed();
/**
- * Flush any currently batched messages to the remote endpoint. This method
- * will block until the flush completes.
+ * Flush any currently batched messages to the remote endpoint. This method will block until the flush completes.
*
* @throws IOException If an I/O error occurs while flushing
*/
void flushBatch() throws IOException;
/**
- * Send a ping message blocking until the message has been sent. Note that
- * if a message is in the process of being sent asynchronously, this method
- * will block until that message and this ping has been sent.
+ * Send a ping message blocking until the message has been sent. Note that if a message is in the process of being
+ * sent asynchronously, this method will block until that message and this ping has been sent.
*
- * @param applicationData The payload for the ping message
+ * @param applicationData The payload for the ping message
*
- * @throws IOException If an I/O error occurs while sending the ping
- * @throws IllegalArgumentException if the applicationData is too large for
- * a control message (max 125 bytes)
+ * @throws IOException If an I/O error occurs while sending the ping
+ * @throws IllegalArgumentException if the applicationData is too large for a control message (max 125 bytes)
*/
- void sendPing(ByteBuffer applicationData)
- throws IOException, IllegalArgumentException;
+ void sendPing(ByteBuffer applicationData) throws IOException, IllegalArgumentException;
/**
- * Send a pong message blocking until the message has been sent. Note that
- * if a message is in the process of being sent asynchronously, this method
- * will block until that message and this pong has been sent.
+ * Send a pong message blocking until the message has been sent. Note that if a message is in the process of being
+ * sent asynchronously, this method will block until that message and this pong has been sent.
*
- * @param applicationData The payload for the pong message
+ * @param applicationData The payload for the pong message
*
- * @throws IOException If an I/O error occurs while sending the pong
- * @throws IllegalArgumentException if the applicationData is too large for
- * a control message (max 125 bytes)
+ * @throws IOException If an I/O error occurs while sending the pong
+ * @throws IllegalArgumentException if the applicationData is too large for a control message (max 125 bytes)
*/
- void sendPong(ByteBuffer applicationData)
- throws IOException, IllegalArgumentException;
+ void sendPong(ByteBuffer applicationData) throws IOException, IllegalArgumentException;
}
diff --git a/java/jakarta/websocket/SendResult.java b/java/jakarta/websocket/SendResult.java
index e3d47ec750..47f5021aac 100644
--- a/java/jakarta/websocket/SendResult.java
+++ b/java/jakarta/websocket/SendResult.java
@@ -26,7 +26,7 @@ public final class SendResult {
}
public SendResult() {
- this (null);
+ this(null);
}
public Throwable getException() {
diff --git a/java/jakarta/websocket/Session.java b/java/jakarta/websocket/Session.java
index 2ff44d68ae..06e25a57fb 100644
--- a/java/jakarta/websocket/Session.java
+++ b/java/jakarta/websocket/Session.java
@@ -28,24 +28,21 @@ public interface Session extends Closeable {
/**
* Get the container that created this session.
+ *
* @return the container that created this session.
*/
WebSocketContainer getContainer();
/**
- * Registers a {@link MessageHandler} for incoming messages. Only one
- * {@link MessageHandler} may be registered for each message type (text,
- * binary, pong). The message type will be derived at runtime from the
- * provided {@link MessageHandler} instance. It is not always possible to do
- * this so it is better to use
- * {@link #addMessageHandler(Class, jakarta.websocket.MessageHandler.Partial)}
- * or
+ * Registers a {@link MessageHandler} for incoming messages. Only one {@link MessageHandler} may be registered for
+ * each message type (text, binary, pong). The message type will be derived at runtime from the provided
+ * {@link MessageHandler} instance. It is not always possible to do this so it is better to use
+ * {@link #addMessageHandler(Class, jakarta.websocket.MessageHandler.Partial)} or
* {@link #addMessageHandler(Class, jakarta.websocket.MessageHandler.Whole)}.
*
- * @param handler The message handler for a incoming message
+ * @param handler The message handler for a incoming message
*
- * @throws IllegalStateException If a message handler has already been
- * registered for the associated message type
+ * @throws IllegalStateException If a message handler has already been registered for the associated message type
*/
void addMessageHandler(MessageHandler handler) throws IllegalStateException;
@@ -65,38 +62,44 @@ public interface Session extends Closeable {
/**
* Get the idle timeout for this session.
- * @return The current idle timeout for this session in milliseconds. Zero
- * or negative values indicate an infinite timeout.
+ *
+ * @return The current idle timeout for this session in milliseconds. Zero or negative values indicate an infinite
+ * timeout.
*/
long getMaxIdleTimeout();
/**
* Set the idle timeout for this session.
- * @param timeout The new idle timeout for this session in milliseconds.
- * Zero or negative values indicate an infinite timeout.
+ *
+ * @param timeout The new idle timeout for this session in milliseconds. Zero or negative values indicate an
+ * infinite timeout.
*/
void setMaxIdleTimeout(long timeout);
/**
* Set the current maximum buffer size for binary messages.
+ *
* @param max The new maximum buffer size in bytes
*/
void setMaxBinaryMessageBufferSize(int max);
/**
* Get the current maximum buffer size for binary messages.
+ *
* @return The current maximum buffer size in bytes
*/
int getMaxBinaryMessageBufferSize();
/**
* Set the maximum buffer size for text messages.
+ *
* @param max The new maximum buffer size in characters.
*/
void setMaxTextMessageBufferSize(int max);
/**
* Get the maximum buffer size for text messages.
+ *
* @return The maximum buffer size in characters.
*/
int getMaxTextMessageBufferSize();
@@ -106,37 +109,35 @@ public interface Session extends Closeable {
RemoteEndpoint.Basic getBasicRemote();
/**
- * Provides a unique identifier for the session. This identifier should not
- * be relied upon to be generated from a secure random source.
+ * Provides a unique identifier for the session. This identifier should not be relied upon to be generated from a
+ * secure random source.
+ *
* @return A unique identifier for the session.
*/
String getId();
/**
* Close the connection to the remote end point using the code
- * {@link jakarta.websocket.CloseReason.CloseCodes#NORMAL_CLOSURE} and an
- * empty reason phrase.
+ * {@link jakarta.websocket.CloseReason.CloseCodes#NORMAL_CLOSURE} and an empty reason phrase.
*
- * @throws IOException if an I/O error occurs while the WebSocket session is
- * being closed.
+ * @throws IOException if an I/O error occurs while the WebSocket session is being closed.
*/
@Override
void close() throws IOException;
/**
- * Close the connection to the remote end point using the specified code
- * and reason phrase.
+ * Close the connection to the remote end point using the specified code and reason phrase.
+ *
* @param closeReason The reason the WebSocket session is being closed.
*
- * @throws IOException if an I/O error occurs while the WebSocket session is
- * being closed.
+ * @throws IOException if an I/O error occurs while the WebSocket session is being closed.
*/
void close(CloseReason closeReason) throws IOException;
URI getRequestURI();
- Map<String, List<String>> getRequestParameterMap();
+ Map<String,List<String>> getRequestParameterMap();
String getQueryString();
@@ -147,47 +148,37 @@ public interface Session extends Closeable {
Principal getUserPrincipal();
/**
- * Obtain the set of open sessions associated with the same local endpoint
- * as this session.
+ * Obtain the set of open sessions associated with the same local endpoint as this session.
*
- * @return The set of currently open sessions for the local endpoint that
- * this session is associated with.
+ * @return The set of currently open sessions for the local endpoint that this session is associated with.
*/
Set<Session> getOpenSessions();
/**
- * Registers a {@link MessageHandler} for partial incoming messages. Only
- * one {@link MessageHandler} may be registered for each message type (text
- * or binary, pong messages are never presented as partial messages).
+ * Registers a {@link MessageHandler} for partial incoming messages. Only one {@link MessageHandler} may be
+ * registered for each message type (text or binary, pong messages are never presented as partial messages).
*
- * @param <T> The type of message that the given handler is intended
- * for
- * @param clazz The Class that implements T
- * @param handler The message handler for a incoming message
+ * @param <T> The type of message that the given handler is intended for
+ * @param clazz The Class that implements T
+ * @param handler The message handler for a incoming message
*
- * @throws IllegalStateException If a message handler has already been
- * registered for the associated message type
+ * @throws IllegalStateException If a message handler has already been registered for the associated message type
*
* @since WebSocket 1.1
*/
- <T> void addMessageHandler(Class<T> clazz, MessageHandler.Partial<T> handler)
- throws IllegalStateException;
+ <T> void addMessageHandler(Class<T> clazz, MessageHandler.Partial<T> handler) throws IllegalStateException;
/**
- * Registers a {@link MessageHandler} for whole incoming messages. Only
- * one {@link MessageHandler} may be registered for each message type (text,
- * binary, pong).
+ * Registers a {@link MessageHandler} for whole incoming messages. Only one {@link MessageHandler} may be registered
+ * for each message type (text, binary, pong).
*
- * @param <T> The type of message that the given handler is intended
- * for
- * @param clazz The Class that implements T
- * @param handler The message handler for a incoming message
+ * @param <T> The type of message that the given handler is intended for
+ * @param clazz The Class that implements T
+ * @param handler The message handler for a incoming message
*
- * @throws IllegalStateException If a message handler has already been
- * registered for the associated message type
+ * @throws IllegalStateException If a message handler has already been registered for the associated message type
*
* @since WebSocket 1.1
*/
- <T> void addMessageHandler(Class<T> clazz, MessageHandler.Whole<T> handler)
- throws IllegalStateException;
+ <T> void addMessageHandler(Class<T> clazz, MessageHandler.Whole<T> handler) throws IllegalStateException;
}
diff --git a/java/jakarta/websocket/WebSocketContainer.java b/java/jakarta/websocket/WebSocketContainer.java
index d7fd1aa5d7..82ddb7ff47 100644
--- a/java/jakarta/websocket/WebSocketContainer.java
+++ b/java/jakarta/websocket/WebSocketContainer.java
@@ -24,108 +24,100 @@ public interface WebSocketContainer {
/**
* Get the default timeout for sending a message asynchronously.
- * @return The current default timeout in milliseconds. A non-positive value
- * means an infinite timeout.
+ *
+ * @return The current default timeout in milliseconds. A non-positive value means an infinite timeout.
*/
long getDefaultAsyncSendTimeout();
/**
* Set the default timeout for sending a message asynchronously.
- * @param timeout The new default timeout in milliseconds. A non-positive
- * value means an infinite timeout.
+ *
+ * @param timeout The new default timeout in milliseconds. A non-positive value means an infinite timeout.
*/
void setAsyncSendTimeout(long timeout);
- Session connectToServer(Object endpoint, URI path)
- throws DeploymentException, IOException;
+ Session connectToServer(Object endpoint, URI path) throws DeploymentException, IOException;
- Session connectToServer(Class<?> annotatedEndpointClass, URI path)
- throws DeploymentException, IOException;
+ Session connectToServer(Class<?> annotatedEndpointClass, URI path) throws DeploymentException, IOException;
/**
* Creates a new connection to the WebSocket.
*
- * @param endpoint
- * The endpoint instance that will handle responses from the
- * server
- * @param clientEndpointConfiguration
- * Used to configure the new connection
- * @param path
- * The full URL of the WebSocket endpoint to connect to
+ * @param endpoint The endpoint instance that will handle responses from the server
+ * @param clientEndpointConfiguration Used to configure the new connection
+ * @param path The full URL of the WebSocket endpoint to connect to
*
* @return The WebSocket session for the connection
*
- * @throws DeploymentException If the connection cannot be established
- * @throws IOException If an I/O occurred while trying to establish the
- * connection
+ * @throws DeploymentException If the connection cannot be established
+ * @throws IOException If an I/O occurred while trying to establish the connection
*/
- Session connectToServer(Endpoint endpoint,
- ClientEndpointConfig clientEndpointConfiguration, URI path)
+ Session connectToServer(Endpoint endpoint, ClientEndpointConfig clientEndpointConfiguration, URI path)
throws DeploymentException, IOException;
/**
* Creates a new connection to the WebSocket.
*
- * @param endpoint
- * An instance of this class will be created to handle responses
- * from the server
- * @param clientEndpointConfiguration
- * Used to configure the new connection
- * @param path
- * The full URL of the WebSocket endpoint to connect to
+ * @param endpoint An instance of this class will be created to handle responses from the server
+ * @param clientEndpointConfiguration Used to configure the new connection
+ * @param path The full URL of the WebSocket endpoint to connect to
*
* @return The WebSocket session for the connection
*
- * @throws DeploymentException If the connection cannot be established
- * @throws IOException If an I/O occurred while trying to establish the
- * connection
+ * @throws DeploymentException If the connection cannot be established
+ * @throws IOException If an I/O occurred while trying to establish the connection
*/
- Session connectToServer(Class<? extends Endpoint> endpoint,
- ClientEndpointConfig clientEndpointConfiguration, URI path)
- throws DeploymentException, IOException;
+ Session connectToServer(Class<? extends Endpoint> endpoint, ClientEndpointConfig clientEndpointConfiguration,
+ URI path) throws DeploymentException, IOException;
/**
* Get the current default session idle timeout.
- * @return The current default session idle timeout in milliseconds. Zero or
- * negative values indicate an infinite timeout.
+ *
+ * @return The current default session idle timeout in milliseconds. Zero or negative values indicate an infinite
+ * timeout.
*/
long getDefaultMaxSessionIdleTimeout();
/**
* Set the default session idle timeout.
- * @param timeout The new default session idle timeout in milliseconds. Zero
- * or negative values indicate an infinite timeout.
+ *
+ * @param timeout The new default session idle timeout in milliseconds. Zero or negative values indicate an infinite
+ * timeout.
*/
void setDefaultMaxSessionIdleTimeout(long timeout);
/**
* Get the default maximum buffer size for binary messages.
+ *
* @return The current default maximum buffer size in bytes
*/
int getDefaultMaxBinaryMessageBufferSize();
/**
* Set the default maximum buffer size for binary messages.
+ *
* @param max The new default maximum buffer size in bytes
*/
void setDefaultMaxBinaryMessageBufferSize(int max);
/**
* Get the default maximum buffer size for text messages.
+ *
* @return The current default maximum buffer size in characters
*/
int getDefaultMaxTextMessageBufferSize();
/**
* Set the default maximum buffer size for text messages.
+ *
* @param max The new default maximum buffer size in characters
*/
void setDefaultMaxTextMessageBufferSize(int max);
/**
* Get the installed extensions.
- * @return The set of extensions that are supported by this WebSocket
- * implementation.
+ *
+ * @return The set of extensions that are supported by this WebSocket implementation.
*/
Set<Extension> getInstalledExtensions();
}
diff --git a/java/jakarta/websocket/server/DefaultServerEndpointConfig.java b/java/jakarta/websocket/server/DefaultServerEndpointConfig.java
index 7dc0a3ebe0..63c7389ce6 100644
--- a/java/jakarta/websocket/server/DefaultServerEndpointConfig.java
+++ b/java/jakarta/websocket/server/DefaultServerEndpointConfig.java
@@ -38,12 +38,9 @@ final class DefaultServerEndpointConfig implements ServerEndpointConfig {
private final Configurator serverEndpointConfigurator;
private final Map<String,Object> userProperties = new ConcurrentHashMap<>();
- DefaultServerEndpointConfig(
- Class<?> endpointClass, String path,
- List<String> subprotocols, List<Extension> extensions,
- List<Class<? extends Encoder>> encoders,
- List<Class<? extends Decoder>> decoders,
- Configurator serverEndpointConfigurator) {
+ DefaultServerEndpointConfig(Class<?> endpointClass, String path, List<String> subprotocols,
+ List<Extension> extensions, List<Class<? extends Encoder>> encoders,
+ List<Class<? extends Decoder>> decoders, Configurator serverEndpointConfigurator) {
this.endpointClass = endpointClass;
this.path = path;
this.subprotocols = subprotocols;
@@ -79,7 +76,7 @@ final class DefaultServerEndpointConfig implements ServerEndpointConfig {
}
@Override
- public Map<String, Object> getUserProperties() {
+ public Map<String,Object> getUserProperties() {
return userProperties;
}
diff --git a/java/jakarta/websocket/server/HandshakeRequest.java b/java/jakarta/websocket/server/HandshakeRequest.java
index 0d9c37dfc9..457942ed76 100644
--- a/java/jakarta/websocket/server/HandshakeRequest.java
+++ b/java/jakarta/websocket/server/HandshakeRequest.java
@@ -29,7 +29,7 @@ public interface HandshakeRequest {
String SEC_WEBSOCKET_KEY = "Sec-WebSocket-Key";
String SEC_WEBSOCKET_PROTOCOL = "Sec-WebSocket-Protocol";
String SEC_WEBSOCKET_VERSION = "Sec-WebSocket-Version";
- String SEC_WEBSOCKET_EXTENSIONS= "Sec-WebSocket-Extensions";
+ String SEC_WEBSOCKET_EXTENSIONS = "Sec-WebSocket-Extensions";
Map<String,List<String>> getHeaders();
@@ -40,14 +40,14 @@ public interface HandshakeRequest {
boolean isUserInRole(String role);
/**
- * Get the HTTP Session object associated with this request. Object is used
- * to avoid a direct dependency on the Servlet API.
- * @return The jakarta.servlet.http.HttpSession object associated with this
- * request, if any.
+ * Get the HTTP Session object associated with this request. Object is used to avoid a direct dependency on the
+ * Servlet API.
+ *
+ * @return The jakarta.servlet.http.HttpSession object associated with this request, if any.
*/
Object getHttpSession();
- Map<String, List<String>> getParameterMap();
+ Map<String,List<String>> getParameterMap();
String getQueryString();
}
diff --git a/java/jakarta/websocket/server/PathParam.java b/java/jakarta/websocket/server/PathParam.java
index bcf613f348..e61294b428 100644
--- a/java/jakarta/websocket/server/PathParam.java
+++ b/java/jakarta/websocket/server/PathParam.java
@@ -22,9 +22,8 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
- * Used to annotate method parameters on POJO endpoints the the {@link
- * ServerEndpoint} has been defined with a {@link ServerEndpoint#value()} that
- * uses a URI template.
+ * Used to annotate method parameters on POJO endpoints the the {@link ServerEndpoint} has been defined with a
+ * {@link ServerEndpoint#value()} that uses a URI template.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
diff --git a/java/jakarta/websocket/server/ServerApplicationConfig.java b/java/jakarta/websocket/server/ServerApplicationConfig.java
index 8f59597ef8..ec23a48958 100644
--- a/java/jakarta/websocket/server/ServerApplicationConfig.java
+++ b/java/jakarta/websocket/server/ServerApplicationConfig.java
@@ -21,31 +21,26 @@ import java.util.Set;
import jakarta.websocket.Endpoint;
/**
- * Applications may provide an implementation of this interface to filter the
- * discovered WebSocket endpoints that are deployed. Implementations of this
- * class will be discovered via an ServletContainerInitializer scan.
+ * Applications may provide an implementation of this interface to filter the discovered WebSocket endpoints that are
+ * deployed. Implementations of this class will be discovered via an ServletContainerInitializer scan.
*/
public interface ServerApplicationConfig {
/**
- * Enables applications to filter the discovered implementations of
- * {@link ServerEndpointConfig}.
+ * Enables applications to filter the discovered implementations of {@link ServerEndpointConfig}.
*
- * @param scanned The {@link Endpoint} implementations found in the
- * application
- * @return The set of configurations for the endpoint the application
- * wishes to deploy
+ * @param scanned The {@link Endpoint} implementations found in the application
+ *
+ * @return The set of configurations for the endpoint the application wishes to deploy
*/
- Set<ServerEndpointConfig> getEndpointConfigs(
- Set<Class<? extends Endpoint>> scanned);
+ Set<ServerEndpointConfig> getEndpointConfigs(Set<Class<? extends Endpoint>> scanned);
/**
- * Enables applications to filter the discovered classes annotated with
- * {@link ServerEndpoint}.
+ * Enables applications to filter the discovered classes annotated with {@link ServerEndpoint}.
+ *
+ * @param scanned The POJOs annotated with {@link ServerEndpoint} found in the application
*
- * @param scanned The POJOs annotated with {@link ServerEndpoint} found in
- * the application
- * @return The set of POJOs the application wishes to deploy
+ * @return The set of POJOs the application wishes to deploy
*/
Set<Class<?>> getAnnotatedEndpointClasses(Set<Class<?>> scanned);
}
diff --git a/java/jakarta/websocket/server/ServerContainer.java b/java/jakarta/websocket/server/ServerContainer.java
index 5f8b1c0ad5..82b92dc7bd 100644
--- a/java/jakarta/websocket/server/ServerContainer.java
+++ b/java/jakarta/websocket/server/ServerContainer.java
@@ -40,20 +40,23 @@ public interface ServerContainer extends WebSocketContainer {
* If the WebSocket implementation is not deployed as part of a Jakarta Servlet container, this method will throw an
* {@link UnsupportedOperationException}.
*
- * @param httpServletRequest The {@code HttpServletRequest} to be processed as a WebSocket handshake as per
- * section 4.0 of RFC 6455.
- * @param httpServletResponse The {@code HttpServletResponse} to be used when processing the
- * {@code httpServletRequest} as a WebSocket handshake as per section 4.0 of RFC 6455.
- * @param sec The server endpoint configuration to use to configure the WebSocket endpoint
- * @param pathParameters Provides a mapping of path parameter names and values, if any, to be used for the
- * WebSocket connection established by the call to this method. If no such mapping is
- * defined, an empty Map must be passed.
+ * @param httpServletRequest The {@code HttpServletRequest} to be processed as a WebSocket handshake as per section
+ * 4.0 of RFC 6455.
+ * @param httpServletResponse The {@code HttpServletResponse} to be used when processing the
+ * {@code httpServletRequest} as a WebSocket handshake as per section 4.0 of RFC
+ * 6455.
+ * @param sec The server endpoint configuration to use to configure the WebSocket endpoint
+ * @param pathParameters Provides a mapping of path parameter names and values, if any, to be used for the
+ * WebSocket connection established by the call to this method. If no such mapping is
+ * defined, an empty Map must be passed.
*
- * @throws IllegalStateException if the provided request does not meet the requirements of the WebSocket handshake
+ * @throws IllegalStateException if the provided request does not meet the requirements of the WebSocket
+ * handshake
* @throws UnsupportedOperationException if the WebSocket implementation is not deployed as part of a Jakarta
- * Servlet container
- * @throws IOException if an I/O error occurs during the establishment of a WebSocket connection
- * @throws DeploymentException if a configuration error prevents the establishment of a WebSocket connection
+ * Servlet container
+ * @throws IOException if an I/O error occurs during the establishment of a WebSocket connection
+ * @throws DeploymentException if a configuration error prevents the establishment of a WebSocket
+ * connection
*
* @since WebSocket 2.0
*/
diff --git a/java/jakarta/websocket/server/ServerEndpoint.java b/java/jakarta/websocket/server/ServerEndpoint.java
index e8ba09a198..b29ebec134 100644
--- a/java/jakarta/websocket/server/ServerEndpoint.java
+++ b/java/jakarta/websocket/server/ServerEndpoint.java
@@ -30,8 +30,8 @@ public @interface ServerEndpoint {
/**
* URI or URI-template that the annotated class should be mapped to.
- * @return The URI or URI-template that the annotated class should be mapped
- * to.
+ *
+ * @return The URI or URI-template that the annotated class should be mapped to.
*/
String value();
@@ -41,6 +41,5 @@ public @interface ServerEndpoint {
Class<? extends Encoder>[] encoders() default {};
- Class<? extends ServerEndpointConfig.Configurator> configurator()
- default ServerEndpointConfig.Configurator.class;
+ Class<? extends ServerEndpointConfig.Configurator> configurator() default ServerEndpointConfig.Configurator.class;
}
diff --git a/java/jakarta/websocket/server/ServerEndpointConfig.java b/java/jakarta/websocket/server/ServerEndpointConfig.java
index 472fc36195..4f21c42c51 100644
--- a/java/jakarta/websocket/server/ServerEndpointConfig.java
+++ b/java/jakarta/websocket/server/ServerEndpointConfig.java
@@ -28,17 +28,17 @@ import jakarta.websocket.Extension;
import jakarta.websocket.HandshakeResponse;
/**
- * Provides configuration information for WebSocket endpoints published to a
- * server. Applications may provide their own implementation or use
- * {@link Builder}.
+ * Provides configuration information for WebSocket endpoints published to a server. Applications may provide their own
+ * implementation or use {@link Builder}.
*/
public interface ServerEndpointConfig extends EndpointConfig {
Class<?> getEndpointClass();
/**
- * Returns the path at which this WebSocket server endpoint has been
- * registered. It may be a path or a level 0 URI template.
+ * Returns the path at which this WebSocket server endpoint has been registered. It may be a path or a level 0 URI
+ * template.
+ *
* @return The registered path
*/
String getPath();
@@ -52,26 +52,21 @@ public interface ServerEndpointConfig extends EndpointConfig {
final class Builder {
- public static Builder create(
- Class<?> endpointClass, String path) {
+ public static Builder create(Class<?> endpointClass, String path) {
return new Builder(endpointClass, path);
}
private final Class<?> endpointClass;
private final String path;
- private List<Class<? extends Encoder>> encoders =
- Collections.emptyList();
- private List<Class<? extends Decoder>> decoders =
- Collections.emptyList();
+ private List<Class<? extends Encoder>> encoders = Collections.emptyList();
+ private List<Class<? extends Decoder>> decoders = Collections.emptyList();
private List<String> subprotocols = Collections.emptyList();
private List<Extension> extensions = Collections.emptyList();
- private Configurator configurator =
- Configurator.fetchContainerDefaultConfigurator();
+ private Configurator configurator = Configurator.fetchContainerDefaultConfigurator();
- private Builder(Class<?> endpointClass,
- String path) {
+ private Builder(Class<?> endpointClass, String path) {
if (endpointClass == null) {
throw new IllegalArgumentException("Endpoint class may not be null");
}
@@ -89,13 +84,12 @@ public interface ServerEndpointConfig extends EndpointConfig {
}
public ServerEndpointConfig build() {
- return new DefaultServerEndpointConfig(endpointClass, path,
- subprotocols, extensions, encoders, decoders, configurator);
+ return new DefaultServerEndpointConfig(endpointClass, path, subprotocols, extensions, encoders, decoders,
+ configurator);
}
- public Builder encoders(
- List<Class<? extends Encoder>> encoders) {
+ public Builder encoders(List<Class<? extends Encoder>> encoders) {
if (encoders == null || encoders.size() == 0) {
this.encoders = Collections.emptyList();
} else {
@@ -105,8 +99,7 @@ public interface ServerEndpointConfig extends EndpointConfig {
}
- public Builder decoders(
- List<Class<? extends Decoder>> decoders) {
+ public Builder decoders(List<Class<? extends Decoder>> decoders) {
if (decoders == null || decoders.size() == 0) {
this.decoders = Collections.emptyList();
} else {
@@ -116,8 +109,7 @@ public interface ServerEndpointConfig extends EndpointConfig {
}
- public Builder subprotocols(
- List<String> subprotocols) {
+ public Builder subprotocols(List<String> subprotocols) {
if (subprotocols == null || subprotocols.size() == 0) {
this.subprotocols = Collections.emptyList();
} else {
@@ -127,8 +119,7 @@ public interface ServerEndpointConfig extends EndpointConfig {
}
- public Builder extensions(
- List<Extension> extensions) {
+ public Builder extensions(List<Extension> extensions) {
if (extensions == null || extensions.size() == 0) {
this.extensions = Collections.emptyList();
} else {
@@ -172,8 +163,7 @@ public interface ServerEndpointConfig extends EndpointConfig {
private static Configurator loadDefault() {
Configurator result = null;
- ServiceLoader<Configurator> serviceLoader =
- ServiceLoader.load(Configurator.class);
+ ServiceLoader<Configurator> serviceLoader = ServiceLoader.load(Configurator.class);
Iterator<Configurator> iter = serviceLoader.iterator();
while (result == null && iter.hasNext()) {
@@ -184,12 +174,9 @@ public interface ServerEndpointConfig extends EndpointConfig {
if (result == null) {
try {
@SuppressWarnings("unchecked")
- Class<Configurator> clazz =
- (Class<Configurator>) Class.forName(
- DEFAULT_IMPL_CLASSNAME);
+ Class<Configurator> clazz = (Class<Configurator>) Class.forName(DEFAULT_IMPL_CLASSNAME);
result = clazz.getConstructor().newInstance();
- } catch (ReflectiveOperationException | IllegalArgumentException |
- SecurityException e) {
+ } catch (ReflectiveOperationException | IllegalArgumentException | SecurityException e) {
// No options left. Just return null.
}
}
@@ -208,13 +195,11 @@ public interface ServerEndpointConfig extends EndpointConfig {
return fetchContainerDefaultConfigurator();
}
- public String getNegotiatedSubprotocol(List<String> supported,
- List<String> requested) {
+ public String getNegotiatedSubprotocol(List<String> supported, List<String> requested) {
return fetchContainerDefaultConfigurator().getNegotiatedSubprotocol(supported, requested);
}
- public List<Extension> getNegotiatedExtensions(List<Extension> installed,
- List<Extension> requested) {
+ public List<Extension> getNegotiatedExtensions(List<Extension> installed, List<Extension> requested) {
return fetchContainerDefaultConfigurator().getNegotiatedExtensions(installed, requested);
}
@@ -222,15 +207,12 @@ public interface ServerEndpointConfig extends EndpointConfig {
return fetchContainerDefaultConfigurator().checkOrigin(originHeaderValue);
}
- public void modifyHandshake(ServerEndpointConfig sec,
- HandshakeRequest request, HandshakeResponse response) {
+ public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
fetchContainerDefaultConfigurator().modifyHandshake(sec, request, response);
}
- public <T extends Object> T getEndpointInstance(Class<T> clazz)
- throws InstantiationException {
- return fetchContainerDefaultConfigurator().getEndpointInstance(
- clazz);
+ public <T extends Object> T getEndpointInstance(Class<T> clazz) throws InstantiationException {
+ return fetchContainerDefaultConfigurator().getEndpointInstance(clazz);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org