This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new ac8e047279 Code clean-up - formatting. No functional change.
ac8e047279 is described below
commit ac8e047279e249ed3794dfcf44bb496abc65058a
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Aug 29 12:03:47 2025 +0100
Code clean-up - formatting. No functional change.
---
.../tomcat/websocket/AsyncChannelGroupUtil.java | 4 +-
.../tomcat/websocket/AsyncChannelWrapper.java | 4 +-
.../websocket/AsyncChannelWrapperNonSecure.java | 4 +-
.../websocket/AsyncChannelWrapperSecure.java | 34 ++++++++--------
.../org/apache/tomcat/websocket/Authenticator.java | 8 ++--
.../tomcat/websocket/BasicAuthenticator.java | 2 +-
java/org/apache/tomcat/websocket/Constants.java | 36 +++++++++--------
.../tomcat/websocket/DigestAuthenticator.java | 5 ++-
.../apache/tomcat/websocket/PerMessageDeflate.java | 4 +-
java/org/apache/tomcat/websocket/Util.java | 33 ++++++++--------
.../org/apache/tomcat/websocket/WsFrameClient.java | 4 +-
.../tomcat/websocket/WsHandshakeResponse.java | 8 ++--
.../tomcat/websocket/WsRemoteEndpointImplBase.java | 21 +++++-----
java/org/apache/tomcat/websocket/WsSession.java | 37 +++++++++---------
.../tomcat/websocket/WsWebSocketContainer.java | 45 +++++++++++-----------
15 files changed, 127 insertions(+), 122 deletions(-)
diff --git a/java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java
b/java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java
index dc6ec3ff2a..0926f2b857 100644
--- a/java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java
+++ b/java/org/apache/tomcat/websocket/AsyncChannelGroupUtil.java
@@ -81,8 +81,8 @@ public class AsyncChannelGroupUtil {
// These are the same settings as the default
// AsynchronousChannelGroup
int initialSize = Runtime.getRuntime().availableProcessors();
- ExecutorService executorService = new ThreadPoolExecutor(0,
Integer.MAX_VALUE, 60,
- TimeUnit.SECONDS, new SynchronousQueue<>(), new
AsyncIOThreadFactory());
+ ExecutorService executorService = new ThreadPoolExecutor(0,
Integer.MAX_VALUE, 60, TimeUnit.SECONDS,
+ new SynchronousQueue<>(), new AsyncIOThreadFactory());
try {
return
AsynchronousChannelGroup.withCachedThreadPool(executorService, initialSize);
diff --git a/java/org/apache/tomcat/websocket/AsyncChannelWrapper.java
b/java/org/apache/tomcat/websocket/AsyncChannelWrapper.java
index 978dc3fa73..d5d87a858d 100644
--- a/java/org/apache/tomcat/websocket/AsyncChannelWrapper.java
+++ b/java/org/apache/tomcat/websocket/AsyncChannelWrapper.java
@@ -33,12 +33,12 @@ public interface AsyncChannelWrapper {
Future<Integer> read(ByteBuffer dst);
- <B, A extends B> void read(ByteBuffer dst, A attachment,
CompletionHandler<Integer, B> handler);
+ <B, A extends B> void read(ByteBuffer dst, A attachment,
CompletionHandler<Integer,B> handler);
Future<Integer> write(ByteBuffer src);
<B, A extends B> void write(ByteBuffer[] srcs, int offset, int length,
long timeout, TimeUnit unit, A attachment,
- CompletionHandler<Long, B> handler);
+ CompletionHandler<Long,B> handler);
void close();
diff --git a/java/org/apache/tomcat/websocket/AsyncChannelWrapperNonSecure.java
b/java/org/apache/tomcat/websocket/AsyncChannelWrapperNonSecure.java
index 31a0e29cb4..d9aee3d0b1 100644
--- a/java/org/apache/tomcat/websocket/AsyncChannelWrapperNonSecure.java
+++ b/java/org/apache/tomcat/websocket/AsyncChannelWrapperNonSecure.java
@@ -46,7 +46,7 @@ public class AsyncChannelWrapperNonSecure implements
AsyncChannelWrapper {
}
@Override
- public <B, A extends B> void read(ByteBuffer dst, A attachment,
CompletionHandler<Integer, B> handler) {
+ public <B, A extends B> void read(ByteBuffer dst, A attachment,
CompletionHandler<Integer,B> handler) {
socketChannel.read(dst, attachment, handler);
}
@@ -57,7 +57,7 @@ public class AsyncChannelWrapperNonSecure implements
AsyncChannelWrapper {
@Override
public <B, A extends B> void write(ByteBuffer[] srcs, int offset, int
length, long timeout, TimeUnit unit,
- A attachment, CompletionHandler<Long, B> handler) {
+ A attachment, CompletionHandler<Long,B> handler) {
socketChannel.write(srcs, offset, length, timeout, unit, attachment,
handler);
}
diff --git a/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java
b/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java
index 21d00ffd20..d4a764d173 100644
--- a/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java
+++ b/java/org/apache/tomcat/websocket/AsyncChannelWrapperSecure.java
@@ -73,7 +73,7 @@ public class AsyncChannelWrapperSecure implements
AsyncChannelWrapper {
@Override
public Future<Integer> read(ByteBuffer dst) {
- WrapperFuture<Integer, Void> future = new WrapperFuture<>();
+ WrapperFuture<Integer,Void> future = new WrapperFuture<>();
if (!reading.compareAndSet(false, true)) {
throw new
IllegalStateException(sm.getString("asyncChannelWrapperSecure.concurrentRead"));
@@ -87,9 +87,9 @@ public class AsyncChannelWrapperSecure implements
AsyncChannelWrapper {
}
@Override
- public <B, A extends B> void read(ByteBuffer dst, A attachment,
CompletionHandler<Integer, B> handler) {
+ public <B, A extends B> void read(ByteBuffer dst, A attachment,
CompletionHandler<Integer,B> handler) {
- WrapperFuture<Integer, B> future = new WrapperFuture<>(handler,
attachment);
+ WrapperFuture<Integer,B> future = new WrapperFuture<>(handler,
attachment);
if (!reading.compareAndSet(false, true)) {
throw new
IllegalStateException(sm.getString("asyncChannelWrapperSecure.concurrentRead"));
@@ -103,7 +103,7 @@ public class AsyncChannelWrapperSecure implements
AsyncChannelWrapper {
@Override
public Future<Integer> write(ByteBuffer src) {
- WrapperFuture<Long, Void> inner = new WrapperFuture<>();
+ WrapperFuture<Long,Void> inner = new WrapperFuture<>();
if (!writing.compareAndSet(false, true)) {
throw new
IllegalStateException(sm.getString("asyncChannelWrapperSecure.concurrentWrite"));
@@ -118,9 +118,9 @@ public class AsyncChannelWrapperSecure implements
AsyncChannelWrapper {
@Override
public <B, A extends B> void write(ByteBuffer[] srcs, int offset, int
length, long timeout, TimeUnit unit,
- A attachment, CompletionHandler<Long, B> handler) {
+ A attachment, CompletionHandler<Long,B> handler) {
- WrapperFuture<Long, B> future = new WrapperFuture<>(handler,
attachment);
+ WrapperFuture<Long,B> future = new WrapperFuture<>(handler,
attachment);
if (!writing.compareAndSet(false, true)) {
throw new
IllegalStateException(sm.getString("asyncChannelWrapperSecure.concurrentWrite"));
@@ -148,7 +148,7 @@ public class AsyncChannelWrapperSecure implements
AsyncChannelWrapper {
@Override
public Future<Void> handshake() throws SSLException {
- WrapperFuture<Void, Void> wFuture = new WrapperFuture<>();
+ WrapperFuture<Void,Void> wFuture = new WrapperFuture<>();
Thread t = new WebSocketSslHandshakeThread(wFuture);
t.start();
@@ -168,9 +168,9 @@ public class AsyncChannelWrapperSecure implements
AsyncChannelWrapper {
private final ByteBuffer[] srcs;
private final int offset;
private final int length;
- private final WrapperFuture<Long, ?> future;
+ private final WrapperFuture<Long,?> future;
- WriteTask(ByteBuffer[] srcs, int offset, int length,
WrapperFuture<Long, ?> future) {
+ WriteTask(ByteBuffer[] srcs, int offset, int length,
WrapperFuture<Long,?> future) {
this.srcs = srcs;
this.future = future;
this.offset = offset;
@@ -239,9 +239,9 @@ public class AsyncChannelWrapperSecure implements
AsyncChannelWrapper {
private class ReadTask implements Runnable {
private final ByteBuffer dest;
- private final WrapperFuture<Integer, ?> future;
+ private final WrapperFuture<Integer,?> future;
- ReadTask(ByteBuffer dest, WrapperFuture<Integer, ?> future) {
+ ReadTask(ByteBuffer dest, WrapperFuture<Integer,?> future) {
this.dest = dest;
this.future = future;
}
@@ -324,8 +324,8 @@ public class AsyncChannelWrapperSecure implements
AsyncChannelWrapper {
} else {
future.fail(new
IllegalStateException(sm.getString("asyncChannelWrapperSecure.wrongStateRead")));
}
- } catch (RuntimeException | ReadBufferOverflowException |
SSLException | EOFException | ExecutionException
- | InterruptedException e) {
+ } catch (RuntimeException | ReadBufferOverflowException |
SSLException | EOFException | ExecutionException |
+ InterruptedException e) {
reading.set(false);
future.fail(e);
}
@@ -335,12 +335,12 @@ public class AsyncChannelWrapperSecure implements
AsyncChannelWrapper {
private class WebSocketSslHandshakeThread extends Thread {
- private final WrapperFuture<Void, Void> hFuture;
+ private final WrapperFuture<Void,Void> hFuture;
private HandshakeStatus handshakeStatus;
private Status resultStatus;
- WebSocketSslHandshakeThread(WrapperFuture<Void, Void> hFuture) {
+ WebSocketSslHandshakeThread(WrapperFuture<Void,Void> hFuture) {
this.hFuture = hFuture;
}
@@ -424,7 +424,7 @@ public class AsyncChannelWrapperSecure implements
AsyncChannelWrapper {
private static class WrapperFuture<T, A> implements Future<T> {
- private final CompletionHandler<T, A> handler;
+ private final CompletionHandler<T,A> handler;
private final A attachment;
private volatile T result = null;
@@ -435,7 +435,7 @@ public class AsyncChannelWrapperSecure implements
AsyncChannelWrapper {
this(null, null);
}
- WrapperFuture(CompletionHandler<T, A> handler, A attachment) {
+ WrapperFuture(CompletionHandler<T,A> handler, A attachment) {
this.handler = handler;
this.attachment = attachment;
}
diff --git a/java/org/apache/tomcat/websocket/Authenticator.java
b/java/org/apache/tomcat/websocket/Authenticator.java
index c04b5963e9..d2e53b078b 100644
--- a/java/org/apache/tomcat/websocket/Authenticator.java
+++ b/java/org/apache/tomcat/websocket/Authenticator.java
@@ -48,7 +48,7 @@ public abstract class Authenticator {
* 10.1.x
*/
@Deprecated
- public String getAuthorization(String requestUri, String
authenticateHeader, Map<String, Object> userProperties)
+ public String getAuthorization(String requestUri, String
authenticateHeader, Map<String,Object> userProperties)
throws AuthenticationException {
return getAuthorization(requestUri, authenticateHeader,
(String)
userProperties.get(Constants.WS_AUTHENTICATION_USER_NAME),
@@ -92,7 +92,7 @@ public abstract class Authenticator {
* @deprecated Use {@link Authenticator#parseAuthenticateHeader(String)}.
Will be removed in Tomcat 10.1.x onwards
*/
@Deprecated
- public Map<String, String> parseWWWAuthenticateHeader(String
authenticateHeader) {
+ public Map<String,String> parseWWWAuthenticateHeader(String
authenticateHeader) {
return parseAuthenticateHeader(authenticateHeader);
}
@@ -104,10 +104,10 @@ public abstract class Authenticator {
*
* @return a map of authentication parameter names and values
*/
- public Map<String, String> parseAuthenticateHeader(String
authenticateHeader) {
+ public Map<String,String> parseAuthenticateHeader(String
authenticateHeader) {
Matcher m = pattern.matcher(authenticateHeader);
- Map<String, String> parameterMap = new HashMap<>();
+ Map<String,String> parameterMap = new HashMap<>();
while (m.find()) {
String key = m.group(1);
diff --git a/java/org/apache/tomcat/websocket/BasicAuthenticator.java
b/java/org/apache/tomcat/websocket/BasicAuthenticator.java
index c8e63859f9..b669d2eb94 100644
--- a/java/org/apache/tomcat/websocket/BasicAuthenticator.java
+++ b/java/org/apache/tomcat/websocket/BasicAuthenticator.java
@@ -36,7 +36,7 @@ public class BasicAuthenticator extends Authenticator {
validateUsername(userName);
validatePassword(userPassword);
- Map<String, String> parameterMap =
parseAuthenticateHeader(authenticateHeader);
+ Map<String,String> parameterMap =
parseAuthenticateHeader(authenticateHeader);
String realm = parameterMap.get("realm");
validateRealm(userRealm, realm);
diff --git a/java/org/apache/tomcat/websocket/Constants.java
b/java/org/apache/tomcat/websocket/Constants.java
index 3ea477b26e..5a88b6c155 100644
--- a/java/org/apache/tomcat/websocket/Constants.java
+++ b/java/org/apache/tomcat/websocket/Constants.java
@@ -42,8 +42,8 @@ public class Constants {
static final byte INTERNAL_OPCODE_FLUSH = 0x18;
// Buffers
- static final int DEFAULT_BUFFER_SIZE = Integer
- .getInteger("org.apache.tomcat.websocket.DEFAULT_BUFFER_SIZE", 8 *
1024).intValue();
+ static final int DEFAULT_BUFFER_SIZE =
+
Integer.getInteger("org.apache.tomcat.websocket.DEFAULT_BUFFER_SIZE", 8 *
1024).intValue();
// Client connection
/**
@@ -100,8 +100,8 @@ public class Constants {
public static final int PROXY_AUTHENTICATION_REQUIRED = 407;
// Configuration for Origin header in client
- static final String DEFAULT_ORIGIN_HEADER_VALUE = System
-
.getProperty("org.apache.tomcat.websocket.DEFAULT_ORIGIN_HEADER_VALUE");
+ static final String DEFAULT_ORIGIN_HEADER_VALUE =
+
System.getProperty("org.apache.tomcat.websocket.DEFAULT_ORIGIN_HEADER_VALUE");
// Configuration for blocking sends
public static final String BLOCKING_SEND_TIMEOUT_PROPERTY =
"org.apache.tomcat.websocket.BLOCKING_SEND_TIMEOUT";
@@ -114,7 +114,8 @@ public class Constants {
public static final long DEFAULT_SESSION_CLOSE_TIMEOUT =
TimeUnit.SECONDS.toMillis(30);
// Configuration for session close timeout
- public static final String ABNORMAL_SESSION_CLOSE_SEND_TIMEOUT_PROPERTY =
"org.apache.tomcat.websocket.ABNORMAL_SESSION_CLOSE_SEND_TIMEOUT";
+ public static final String ABNORMAL_SESSION_CLOSE_SEND_TIMEOUT_PROPERTY =
+ "org.apache.tomcat.websocket.ABNORMAL_SESSION_CLOSE_SEND_TIMEOUT";
// Default is 50 milliseconds - setting is in milliseconds
public static final long DEFAULT_ABNORMAL_SESSION_CLOSE_SEND_TIMEOUT = 50;
@@ -125,26 +126,29 @@ public class Constants {
public static final String WRITE_IDLE_TIMEOUT_MS =
"org.apache.tomcat.websocket.WRITE_IDLE_TIMEOUT_MS";
// Configuration for background processing checks intervals
- static final int DEFAULT_PROCESS_PERIOD = Integer
- .getInteger("org.apache.tomcat.websocket.DEFAULT_PROCESS_PERIOD",
10).intValue();
+ static final int DEFAULT_PROCESS_PERIOD =
+
Integer.getInteger("org.apache.tomcat.websocket.DEFAULT_PROCESS_PERIOD",
10).intValue();
public static final String WS_AUTHENTICATION_USER_NAME =
"org.apache.tomcat.websocket.WS_AUTHENTICATION_USER_NAME";
public static final String WS_AUTHENTICATION_PASSWORD =
"org.apache.tomcat.websocket.WS_AUTHENTICATION_PASSWORD";
public static final String WS_AUTHENTICATION_REALM =
"org.apache.tomcat.websocket.WS_AUTHENTICATION_REALM";
- public static final String WS_AUTHENTICATION_PROXY_USER_NAME =
"org.apache.tomcat.websocket.WS_AUTHENTICATION_PROXY_USER_NAME";
- public static final String WS_AUTHENTICATION_PROXY_PASSWORD =
"org.apache.tomcat.websocket.WS_AUTHENTICATION_PROXY_PASSWORD";
- public static final String WS_AUTHENTICATION_PROXY_REALM =
"org.apache.tomcat.websocket.WS_AUTHENTICATION_PROXY_REALM";
+ public static final String WS_AUTHENTICATION_PROXY_USER_NAME =
+ "org.apache.tomcat.websocket.WS_AUTHENTICATION_PROXY_USER_NAME";
+ public static final String WS_AUTHENTICATION_PROXY_PASSWORD =
+ "org.apache.tomcat.websocket.WS_AUTHENTICATION_PROXY_PASSWORD";
+ public static final String WS_AUTHENTICATION_PROXY_REALM =
+ "org.apache.tomcat.websocket.WS_AUTHENTICATION_PROXY_REALM";
/*
* Configuration for extensions Note: These options are primarily present
to enable this implementation to pass
* compliance tests. They are expected to be removed once the WebSocket
API includes a mechanism for adding custom
* extensions and disabling built-in extensions.
*/
- static final boolean DISABLE_BUILTIN_EXTENSIONS = Boolean
-
.getBoolean("org.apache.tomcat.websocket.DISABLE_BUILTIN_EXTENSIONS");
- static final boolean ALLOW_UNSUPPORTED_EXTENSIONS = Boolean
-
.getBoolean("org.apache.tomcat.websocket.ALLOW_UNSUPPORTED_EXTENSIONS");
+ static final boolean DISABLE_BUILTIN_EXTENSIONS =
+
Boolean.getBoolean("org.apache.tomcat.websocket.DISABLE_BUILTIN_EXTENSIONS");
+ static final boolean ALLOW_UNSUPPORTED_EXTENSIONS =
+
Boolean.getBoolean("org.apache.tomcat.websocket.ALLOW_UNSUPPORTED_EXTENSIONS");
/**
* WebSocket specification compliance flag.
@@ -152,8 +156,8 @@ public class Constants {
* @deprecated This is no longer required in Jakarta EE 10 onwards and
will be removed in Tomcat 10.1.
*/
@Deprecated
- public static final boolean STRICT_SPEC_COMPLIANCE = Boolean
- .getBoolean("org.apache.tomcat.websocket.STRICT_SPEC_COMPLIANCE");
+ public static final boolean STRICT_SPEC_COMPLIANCE =
+
Boolean.getBoolean("org.apache.tomcat.websocket.STRICT_SPEC_COMPLIANCE");
public static final List<Extension> INSTALLED_EXTENSIONS;
diff --git a/java/org/apache/tomcat/websocket/DigestAuthenticator.java
b/java/org/apache/tomcat/websocket/DigestAuthenticator.java
index 392cd97660..20a4ab9d54 100644
--- a/java/org/apache/tomcat/websocket/DigestAuthenticator.java
+++ b/java/org/apache/tomcat/websocket/DigestAuthenticator.java
@@ -46,7 +46,7 @@ public class DigestAuthenticator extends Authenticator {
validateUsername(userName);
validatePassword(userPassword);
- Map<String, String> parameterMap =
parseAuthenticateHeader(authenticateHeader);
+ Map<String,String> parameterMap =
parseAuthenticateHeader(authenticateHeader);
String realm = parameterMap.get("realm");
validateRealm(userRealm, realm);
@@ -79,7 +79,8 @@ public class DigestAuthenticator extends Authenticator {
try {
challenge.append("response=\"");
- challenge.append(calculateRequestDigest(requestUri, userName,
userPassword, realm, nonce, messageQop, algorithm));
+ challenge.append(
+ calculateRequestDigest(requestUri, userName, userPassword,
realm, nonce, messageQop, algorithm));
challenge.append("\",");
}
diff --git a/java/org/apache/tomcat/websocket/PerMessageDeflate.java
b/java/org/apache/tomcat/websocket/PerMessageDeflate.java
index 08c1146cc3..133f8bd10e 100644
--- a/java/org/apache/tomcat/websocket/PerMessageDeflate.java
+++ b/java/org/apache/tomcat/websocket/PerMessageDeflate.java
@@ -401,14 +401,14 @@ public class PerMessageDeflate implements Transformation {
compressedPart = new MessagePart(false,
getRsv(uncompressedPart), opCode, compressedPayload,
uncompressedIntermediateHandler,
uncompressedIntermediateHandler,
blockingWriteTimeoutExpiry);
- } else if (!fin && full/* note: needsInput is true here*/)
{
+ } else if (!fin && full/* note: needsInput is true here
*/) {
// Write buffer full and input message not fully read.
// Output and get more data.
compressedPart = new MessagePart(false,
getRsv(uncompressedPart), opCode, compressedPayload,
uncompressedIntermediateHandler,
uncompressedIntermediateHandler,
blockingWriteTimeoutExpiry);
deflateRequired = false;
- } else if (fin && full/* note: needsInput is true here*/) {
+ } else if (fin && full/* note: needsInput is true here */)
{
// Write buffer full. Input fully read. Deflater may be
// in one of four states:
// - output complete (just happened to align with end
of
diff --git a/java/org/apache/tomcat/websocket/Util.java
b/java/org/apache/tomcat/websocket/Util.java
index 855c0e76e0..95ae20dbf2 100644
--- a/java/org/apache/tomcat/websocket/Util.java
+++ b/java/org/apache/tomcat/websocket/Util.java
@@ -221,8 +221,8 @@ public class Util {
// the interface of interest
// Map that unknown type to the generic types defined in this class
ParameterizedType superClassType = (ParameterizedType)
clazz.getGenericSuperclass();
- TypeResult result = getTypeParameter(clazz,
-
superClassType.getActualTypeArguments()[superClassTypeResult.getIndex()]);
+ TypeResult result =
+ getTypeParameter(clazz,
superClassType.getActualTypeArguments()[superClassTypeResult.getIndex()]);
result.incrementDimension(superClassTypeResult.getDimension());
if (result.getClazz() != null && result.getDimension() > 0) {
superClassTypeResult = result;
@@ -286,8 +286,8 @@ public class Util {
return true;
} else {
return clazz.equals(Boolean.class) || clazz.equals(Byte.class) ||
clazz.equals(Character.class) ||
- clazz.equals(Double.class) || clazz.equals(Float.class) ||
clazz.equals(Integer.class) ||
- clazz.equals(Long.class) || clazz.equals(Short.class);
+ clazz.equals(Double.class) || clazz.equals(Float.class) ||
clazz.equals(Integer.class) ||
+ clazz.equals(Long.class) || clazz.equals(Short.class);
}
}
@@ -362,8 +362,8 @@ public class Util {
// Don't need this instance, so destroy it
instanceManager.destroyInstance(instance);
}
- } catch (ReflectiveOperationException |
IllegalArgumentException | SecurityException
- | NamingException e) {
+ } catch (ReflectiveOperationException |
IllegalArgumentException | SecurityException |
+ NamingException e) {
throw new DeploymentException(
sm.getString("pojoMethodMapping.invalidDecoder",
decoderClazz.getName()), e);
}
@@ -397,13 +397,16 @@ public class Util {
// the types expected by the frame handling code
} else if (byte[].class.isAssignableFrom(target)) {
boolean whole =
MessageHandler.Whole.class.isAssignableFrom(listener.getClass());
- MessageHandlerResult result = new MessageHandlerResult(whole
- ? new PojoMessageHandlerWholeBinary(listener,
getOnMessageMethod(listener), session, endpointConfig,
- matchDecoders(target, endpointConfig, true,
((WsSession) session).getInstanceManager()),
- new Object[1], 0, true, -1, false, -1)
- : new PojoMessageHandlerPartialBinary(listener,
getOnMessagePartialMethod(listener), session,
- new Object[2], 0, true, 1, -1, -1),
- MessageHandlerResultType.BINARY);
+ MessageHandlerResult result =
+ new MessageHandlerResult(whole ?
+ new PojoMessageHandlerWholeBinary(listener,
getOnMessageMethod(listener), session,
+ endpointConfig,
+ matchDecoders(target, endpointConfig, true,
+ ((WsSession)
session).getInstanceManager()),
+ new Object[1], 0, true, -1, false, -1) :
+ new PojoMessageHandlerPartialBinary(listener,
getOnMessagePartialMethod(listener), session,
+ new Object[2], 0, true, 1, -1, -1),
+ MessageHandlerResultType.BINARY);
results.add(result);
} else if (InputStream.class.isAssignableFrom(target)) {
MessageHandlerResult result = new MessageHandlerResult(
@@ -422,8 +425,8 @@ public class Util {
} else {
// Handler needs wrapping and requires decoder to convert it to one
// of the types expected by the frame handling code
- DecoderMatch decoderMatch = matchDecoders(target, endpointConfig,
- ((WsSession) session).getInstanceManager());
+ DecoderMatch decoderMatch =
+ matchDecoders(target, endpointConfig, ((WsSession)
session).getInstanceManager());
Method m = getOnMessageMethod(listener);
if (!decoderMatch.getBinaryDecoders().isEmpty()) {
MessageHandlerResult result = new MessageHandlerResult(
diff --git a/java/org/apache/tomcat/websocket/WsFrameClient.java
b/java/org/apache/tomcat/websocket/WsFrameClient.java
index 8b81c7d6d6..85c4fd2d60 100644
--- a/java/org/apache/tomcat/websocket/WsFrameClient.java
+++ b/java/org/apache/tomcat/websocket/WsFrameClient.java
@@ -34,7 +34,7 @@ public class WsFrameClient extends WsFrameBase {
private static final StringManager sm =
StringManager.getManager(WsFrameClient.class);
private final AsyncChannelWrapper channel;
- private final CompletionHandler<Integer, Void> handler;
+ private final CompletionHandler<Integer,Void> handler;
// Not final as it may need to be re-sized
private volatile ByteBuffer response;
@@ -143,7 +143,7 @@ public class WsFrameClient extends WsFrameBase {
return log;
}
- private class WsFrameClientCompletionHandler implements
CompletionHandler<Integer, Void> {
+ private class WsFrameClientCompletionHandler implements
CompletionHandler<Integer,Void> {
@Override
public void completed(Integer result, Void attachment) {
diff --git a/java/org/apache/tomcat/websocket/WsHandshakeResponse.java
b/java/org/apache/tomcat/websocket/WsHandshakeResponse.java
index 2243243f3c..ecb39e4452 100644
--- a/java/org/apache/tomcat/websocket/WsHandshakeResponse.java
+++ b/java/org/apache/tomcat/websocket/WsHandshakeResponse.java
@@ -30,15 +30,15 @@ import
org.apache.tomcat.util.collections.CaseInsensitiveKeyMap;
*/
public class WsHandshakeResponse implements HandshakeResponse {
- private final Map<String, List<String>> headers = new
CaseInsensitiveKeyMap<>();
+ private final Map<String,List<String>> headers = new
CaseInsensitiveKeyMap<>();
public WsHandshakeResponse() {
}
- public WsHandshakeResponse(Map<String, List<String>> headers) {
- for (Entry<String, List<String>> entry : headers.entrySet()) {
+ public WsHandshakeResponse(Map<String,List<String>> headers) {
+ for (Entry<String,List<String>> entry : headers.entrySet()) {
if (this.headers.containsKey(entry.getKey())) {
this.headers.get(entry.getKey()).addAll(entry.getValue());
} else {
@@ -50,7 +50,7 @@ public class WsHandshakeResponse implements HandshakeResponse
{
@Override
- public Map<String, List<String>> getHeaders() {
+ public Map<String,List<String>> getHeaders() {
return headers;
}
}
diff --git a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
index a6bf5181be..9228496a43 100644
--- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
+++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
@@ -207,8 +207,8 @@ public abstract class WsRemoteEndpointImplBase implements
RemoteEndpoint {
throw new
IllegalArgumentException(sm.getString("wsRemoteEndpoint.nullHandler"));
}
stateMachine.textStart();
- TextMessageSendHandler tmsh = new TextMessageSendHandler(handler,
CharBuffer.wrap(text), true, encoder,
- encoderBuffer, this);
+ TextMessageSendHandler tmsh =
+ new TextMessageSendHandler(handler, CharBuffer.wrap(text),
true, encoder, encoderBuffer, this);
tmsh.write();
// TextMessageSendHandler will update stateMachine when it completes
}
@@ -259,8 +259,8 @@ public abstract class WsRemoteEndpointImplBase implements
RemoteEndpoint {
void sendMessageBlock(byte opCode, ByteBuffer payload, boolean last, long
timeout) throws IOException {
/*
- * Get the timeout before we send the message. The message may
trigger a session close and depending on timing
- * the client session may close before we can read the timeout.
+ * Get the timeout before we send the message. The message may trigger
a session close and depending on timing
+ * the client session may close before we can read the timeout.
*/
sendMessageBlockInternal(opCode, payload, last,
getTimeoutExpiry(timeout));
}
@@ -511,9 +511,9 @@ public abstract class WsRemoteEndpointImplBase implements
RemoteEndpoint {
if (getBatchingAllowed() || isMasked()) {
// Need to write via output buffer
- OutputBufferSendHandler obsh = new
OutputBufferSendHandler(mp.getEndHandler(),
- mp.getBlockingWriteTimeoutExpiry(), headerBuffer,
mp.getPayload(), mask, outputBuffer,
- !getBatchingAllowed(), this);
+ OutputBufferSendHandler obsh =
+ new OutputBufferSendHandler(mp.getEndHandler(),
mp.getBlockingWriteTimeoutExpiry(), headerBuffer,
+ mp.getPayload(), mask, outputBuffer,
!getBatchingAllowed(), this);
obsh.write();
} else {
// Can write directly
@@ -572,10 +572,9 @@ public abstract class WsRemoteEndpointImplBase implements
RemoteEndpoint {
/**
* If a transformation needs to split a {@link MessagePart} into multiple
{@link MessagePart}s, it uses this handler
- * as the end handler for each of the additional {@link MessagePart}s.
This handler notifies this class that
- * the {@link MessagePart} has been processed and that the next {@link
MessagePart} in the queue should be started.
- * The final {@link MessagePart} will use the {@link EndMessageHandler}
provided with the original
- * {@link MessagePart}.
+ * as the end handler for each of the additional {@link MessagePart}s.
This handler notifies this class that the
+ * {@link MessagePart} has been processed and that the next {@link
MessagePart} in the queue should be started. The
+ * final {@link MessagePart} will use the {@link EndMessageHandler}
provided with the original {@link MessagePart}.
*/
private static class IntermediateMessageHandler implements SendHandler {
diff --git a/java/org/apache/tomcat/websocket/WsSession.java
b/java/org/apache/tomcat/websocket/WsSession.java
index 987539bf92..c7f0711897 100644
--- a/java/org/apache/tomcat/websocket/WsSession.java
+++ b/java/org/apache/tomcat/websocket/WsSession.java
@@ -79,8 +79,8 @@ public class WsSession implements Session {
// be sufficient to pass the validation tests.
ServerEndpointConfig.Builder builder =
ServerEndpointConfig.Builder.create(Object.class, "/");
ServerEndpointConfig sec = builder.build();
- SEC_CONFIGURATOR_USES_IMPL_DEFAULT = sec.getConfigurator().getClass()
- .equals(DefaultServerEndpointConfigurator.class);
+ SEC_CONFIGURATOR_USES_IMPL_DEFAULT =
+
sec.getConfigurator().getClass().equals(DefaultServerEndpointConfigurator.class);
}
private final Endpoint localEndpoint;
@@ -90,14 +90,14 @@ public class WsSession implements Session {
private final ClassLoader applicationClassLoader;
private final WsWebSocketContainer webSocketContainer;
private final URI requestUri;
- private final Map<String, List<String>> requestParameterMap;
+ private final Map<String,List<String>> requestParameterMap;
private final String queryString;
private final Principal userPrincipal;
private final EndpointConfig endpointConfig;
private final List<Extension> negotiatedExtensions;
private final String subProtocol;
- private final Map<String, String> pathParameters;
+ private final Map<String,String> pathParameters;
private final boolean secure;
private final String httpSessionId;
private final String id;
@@ -108,13 +108,13 @@ public class WsSession implements Session {
private volatile MessageHandler binaryMessageHandler = null;
private volatile MessageHandler.Whole<PongMessage> pongMessageHandler =
null;
private final AtomicReference<State> state = new
AtomicReference<>(State.OPEN);
- private final Map<String, Object> userProperties = new
ConcurrentHashMap<>();
+ private final Map<String,Object> userProperties = new
ConcurrentHashMap<>();
private volatile int maxBinaryMessageBufferSize =
Constants.DEFAULT_BUFFER_SIZE;
private volatile int maxTextMessageBufferSize =
Constants.DEFAULT_BUFFER_SIZE;
private volatile long maxIdleTimeout = 0;
private volatile long lastActiveRead = System.currentTimeMillis();
private volatile long lastActiveWrite = System.currentTimeMillis();
- private final Map<FutureToSendHandler, FutureToSendHandler> futures = new
ConcurrentHashMap<>();
+ private final Map<FutureToSendHandler,FutureToSendHandler> futures = new
ConcurrentHashMap<>();
private volatile Long sessionCloseTimeoutExpiry;
@@ -137,7 +137,7 @@ public class WsSession implements Session {
*/
public WsSession(ClientEndpointHolder clientEndpointHolder,
WsRemoteEndpointImplBase wsRemoteEndpoint,
WsWebSocketContainer wsWebSocketContainer, List<Extension>
negotiatedExtensions, String subProtocol,
- Map<String, String> pathParameters, boolean secure,
ClientEndpointConfig clientEndpointConfig)
+ Map<String,String> pathParameters, boolean secure,
ClientEndpointConfig clientEndpointConfig)
throws DeploymentException {
this.wsRemoteEndpoint = wsRemoteEndpoint;
this.wsRemoteEndpoint.setSession(this);
@@ -203,9 +203,9 @@ public class WsSession implements Session {
* @throws DeploymentException if an invalid encode is specified
*/
public WsSession(WsRemoteEndpointImplBase wsRemoteEndpoint,
WsWebSocketContainer wsWebSocketContainer,
- URI requestUri, Map<String, List<String>> requestParameterMap,
String queryString, Principal userPrincipal,
+ URI requestUri, Map<String,List<String>> requestParameterMap,
String queryString, Principal userPrincipal,
String httpSessionId, List<Extension> negotiatedExtensions, String
subProtocol,
- Map<String, String> pathParameters, boolean secure,
ServerEndpointConfig serverEndpointConfig)
+ Map<String,String> pathParameters, boolean secure,
ServerEndpointConfig serverEndpointConfig)
throws DeploymentException {
this.wsRemoteEndpoint = wsRemoteEndpoint;
@@ -279,8 +279,7 @@ public class WsSession implements Session {
if
(configurator.getClass().equals(DefaultServerEndpointConfigurator.class)) {
return true;
}
- return SEC_CONFIGURATOR_USES_IMPL_DEFAULT &&
- configurator.getClass().equals(Configurator.class);
+ return SEC_CONFIGURATOR_USES_IMPL_DEFAULT &&
configurator.getClass().equals(Configurator.class);
}
@@ -315,9 +314,9 @@ public class WsSession implements Session {
*/
@Deprecated
public WsSession(Endpoint localEndpoint, WsRemoteEndpointImplBase
wsRemoteEndpoint,
- WsWebSocketContainer wsWebSocketContainer, URI requestUri,
Map<String, List<String>> requestParameterMap,
+ WsWebSocketContainer wsWebSocketContainer, URI requestUri,
Map<String,List<String>> requestParameterMap,
String queryString, Principal userPrincipal, String httpSessionId,
List<Extension> negotiatedExtensions,
- String subProtocol, Map<String, String> pathParameters, boolean
secure, EndpointConfig endpointConfig)
+ String subProtocol, Map<String,String> pathParameters, boolean
secure, EndpointConfig endpointConfig)
throws DeploymentException {
this.localEndpoint = localEndpoint;
this.wsRemoteEndpoint = wsRemoteEndpoint;
@@ -727,9 +726,9 @@ public class WsSession implements Session {
closeConnection();
} else if (state.compareAndSet(State.OUTPUT_CLOSING, State.CLOSING)) {
/*
- * The local endpoint sent a close message at the same time as the
remote endpoint. The local close is
- * still being processed. Update the state so the local close
process will also close the network
- * connection once it has finished sending a close message.
+ * The local endpoint sent a close message at the same time as the
remote endpoint. The local close is still
+ * being processed. Update the state so the local close process
will also close the network connection once
+ * it has finished sending a close message.
*/
} else if (state.compareAndSet(State.OUTPUT_CLOSED, State.CLOSED)) {
/*
@@ -1002,7 +1001,7 @@ public class WsSession implements Session {
@Override
- public Map<String, List<String>> getRequestParameterMap() {
+ public Map<String,List<String>> getRequestParameterMap() {
checkState();
return requestParameterMap;
}
@@ -1028,7 +1027,7 @@ public class WsSession implements Session {
@Override
- public Map<String, String> getPathParameters() {
+ public Map<String,String> getPathParameters() {
checkState();
return pathParameters;
}
@@ -1041,7 +1040,7 @@ public class WsSession implements Session {
@Override
- public Map<String, Object> getUserProperties() {
+ public Map<String,Object> getUserProperties() {
checkState();
return userProperties;
}
diff --git a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
index 9a4177b5f4..7df17239be 100644
--- a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
+++ b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
@@ -91,8 +91,8 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
private final Log log = LogFactory.getLog(WsWebSocketContainer.class); //
must not be static
// Server side uses the endpoint path as the key
// Client side uses the client endpoint instance
- private final Map<Object, Set<WsSession>> endpointSessionMap = new
HashMap<>();
- private final Map<WsSession, WsSession> sessions = new
ConcurrentHashMap<>();
+ private final Map<Object,Set<WsSession>> endpointSessionMap = new
HashMap<>();
+ private final Map<WsSession,WsSession> sessions = new
ConcurrentHashMap<>();
private final Object endPointSessionMapLock = new Object();
private long defaultAsyncTimeout = -1;
@@ -155,8 +155,7 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
if (configurator != null) {
builder.configurator(configurator);
}
- return builder.decoders(Arrays.asList(annotation.decoders()))
- .encoders(Arrays.asList(annotation.encoders()))
+ return
builder.decoders(Arrays.asList(annotation.decoders())).encoders(Arrays.asList(annotation.encoders()))
.preferredSubprotocols(Arrays.asList(annotation.subprotocols())).build();
}
@@ -238,7 +237,7 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
}
}
- Map<String, Object> userProperties =
clientEndpointConfiguration.getUserProperties();
+ Map<String,Object> userProperties =
clientEndpointConfiguration.getUserProperties();
// If sa is null, no proxy is configured so need to create sa
if (sa == null) {
@@ -249,7 +248,7 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
}
// Create the initial HTTP request to open the WebSocket connection
- Map<String, List<String>> reqHeaders = createRequestHeaders(host,
port, secure, clientEndpointConfiguration);
+ Map<String,List<String>> reqHeaders = createRequestHeaders(host, port,
secure, clientEndpointConfiguration);
clientEndpointConfiguration.getConfigurator().beforeRequest(reqHeaders);
if (Constants.DEFAULT_ORIGIN_HEADER_VALUE != null &&
!reqHeaders.containsKey(Constants.ORIGIN_HEADER_NAME)) {
List<String> originValues = new ArrayList<>(1);
@@ -340,8 +339,8 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
if (httpResponse.status != 101) {
if (isRedirectStatus(httpResponse.status)) {
- List<String> locationHeader =
httpResponse.getHandshakeResponse().getHeaders()
- .get(Constants.LOCATION_HEADER_NAME);
+ List<String> locationHeader =
+
httpResponse.getHandshakeResponse().getHeaders().get(Constants.LOCATION_HEADER_NAME);
if (locationHeader == null || locationHeader.isEmpty() ||
locationHeader.get(0) == null ||
locationHeader.get(0).isEmpty()) {
@@ -421,8 +420,8 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
}
success = true;
- } catch (ExecutionException | InterruptedException | SSLException |
EOFException | TimeoutException
- | URISyntaxException | AuthenticationException e) {
+ } catch (ExecutionException | InterruptedException | SSLException |
EOFException | TimeoutException |
+ URISyntaxException | AuthenticationException e) {
throw new
DeploymentException(sm.getString("wsWebSocketContainer.httpRequestFailed",
path), e);
} finally {
if (!success) {
@@ -468,7 +467,7 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
private Session processAuthenticationChallenge(ClientEndpointHolder
clientEndpointHolder,
ClientEndpointConfig clientEndpointConfiguration, URI path,
Set<URI> redirectSet,
- Map<String, Object> userProperties, ByteBuffer request,
HttpResponse httpResponse,
+ Map<String,Object> userProperties, ByteBuffer request,
HttpResponse httpResponse,
AuthenticationType authenticationType) throws DeploymentException,
AuthenticationException {
if
(userProperties.get(authenticationType.getAuthorizationHeaderName()) != null) {
@@ -476,8 +475,8 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
Integer.valueOf(httpResponse.status),
authenticationType.getAuthorizationHeaderName()));
}
- List<String> authenticateHeaders =
httpResponse.getHandshakeResponse().getHeaders()
- .get(authenticationType.getAuthenticateHeaderName());
+ List<String> authenticateHeaders =
+
httpResponse.getHandshakeResponse().getHeaders().get(authenticationType.getAuthenticateHeaderName());
if (authenticateHeaders == null || authenticateHeaders.isEmpty() ||
authenticateHeaders.get(0) == null ||
authenticateHeaders.get(0).isEmpty()) {
@@ -618,13 +617,13 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
return result;
}
- private static Map<String, List<String>> createRequestHeaders(String host,
int port, boolean secure,
+ private static Map<String,List<String>> createRequestHeaders(String host,
int port, boolean secure,
ClientEndpointConfig clientEndpointConfiguration) {
- Map<String, List<String>> headers = new HashMap<>();
+ Map<String,List<String>> headers = new HashMap<>();
List<Extension> extensions =
clientEndpointConfiguration.getExtensions();
List<String> subProtocols =
clientEndpointConfiguration.getPreferredSubprotocols();
- Map<String, Object> userProperties =
clientEndpointConfiguration.getUserProperties();
+ Map<String,Object> userProperties =
clientEndpointConfiguration.getUserProperties();
if (userProperties.get(Constants.AUTHORIZATION_HEADER_NAME) != null) {
List<String> authValues = new ArrayList<>(1);
@@ -704,7 +703,7 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
}
- private static ByteBuffer createRequest(URI uri, Map<String, List<String>>
reqHeaders) {
+ private static ByteBuffer createRequest(URI uri, Map<String,List<String>>
reqHeaders) {
ByteBuffer result = ByteBuffer.allocate(4 * 1024);
// Request line
@@ -723,7 +722,7 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
result.put(HTTP_VERSION_BYTES);
// Headers
- for (Entry<String, List<String>> entry : reqHeaders.entrySet()) {
+ for (Entry<String,List<String>> entry : reqHeaders.entrySet()) {
result = addHeader(result, entry.getKey(), entry.getValue());
}
@@ -778,7 +777,7 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
private HttpResponse processResponse(ByteBuffer response,
AsyncChannelWrapper channel, long timeout)
throws InterruptedException, ExecutionException,
DeploymentException, EOFException, TimeoutException {
- Map<String, List<String>> headers = new CaseInsensitiveKeyMap<>();
+ Map<String,List<String>> headers = new CaseInsensitiveKeyMap<>();
int status = 0;
boolean readStatus = false;
@@ -844,7 +843,7 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
}
- private void parseHeaders(String line, Map<String, List<String>> headers) {
+ private void parseHeaders(String line, Map<String,List<String>> headers) {
// Treat headers as single values by default.
int index = line.indexOf(':');
@@ -882,7 +881,7 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
private SSLEngine createSSLEngine(ClientEndpointConfig
clientEndpointConfig, String host, int port)
throws DeploymentException {
- Map<String, Object> userProperties =
clientEndpointConfig.getUserProperties();
+ Map<String,Object> userProperties =
clientEndpointConfig.getUserProperties();
try {
// See if a custom SSLContext has been provided
SSLContext sslContext = (SSLContext)
userProperties.get(Constants.SSL_CONTEXT_PROPERTY);
@@ -905,8 +904,8 @@ public class WsWebSocketContainer implements
WebSocketContainer, BackgroundProce
KeyStoreUtil.load(ks, is,
sslTrustStorePwdValue.toCharArray());
}
- TrustManagerFactory tmf = TrustManagerFactory
-
.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+ TrustManagerFactory tmf =
+
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(ks);
sslContext.init(null, tmf.getTrustManagers(), null);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]