diff --git a/jetty-websocket/websocket-core/src/main/java/module-info.java b/jetty-websocket/websocket-core/src/main/java/module-info.java index e028f524029..038b9931667 100644 --- a/jetty-websocket/websocket-core/src/main/java/module-info.java +++ b/jetty-websocket/websocket-core/src/main/java/module-info.java @@ -27,6 +27,7 @@ module org.eclipse.jetty.websocket.core exports org.eclipse.jetty.websocket.core; exports org.eclipse.jetty.websocket.core.client; exports org.eclipse.jetty.websocket.core.server; + exports org.eclipse.jetty.websocket.core.exception; exports org.eclipse.jetty.websocket.core.internal to org.eclipse.jetty.util; requires jetty.servlet.api; diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/AbstractExtension.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/AbstractExtension.java index 2af69bef8e5..7a0a18cddfc 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/AbstractExtension.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/AbstractExtension.java @@ -26,7 +26,6 @@ import org.eclipse.jetty.util.compression.DeflaterPool; import org.eclipse.jetty.util.compression.InflaterPool; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.FrameHandler.Configuration; @ManagedObject("Abstract Extension") public class AbstractExtension implements Extension diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/CloseStatus.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/CloseStatus.java index e3661992a2a..5ef5617a263 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/CloseStatus.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/CloseStatus.java @@ -25,6 +25,9 @@ import java.util.Arrays; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Utf8Appendable; import org.eclipse.jetty.util.Utf8StringBuilder; +import org.eclipse.jetty.websocket.core.exception.BadPayloadException; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; +import org.eclipse.jetty.websocket.core.internal.NullAppendable; /** * Representation of a WebSocket Close (status code & reason) diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/Configuration.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/Configuration.java new file mode 100644 index 00000000000..09502df7077 --- /dev/null +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/Configuration.java @@ -0,0 +1,221 @@ +// +// ======================================================================== +// Copyright (c) 1995-2019 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.core; + +import java.time.Duration; + +public interface Configuration +{ + /** + * Get the Idle Timeout + * + * @return the idle timeout + */ + Duration getIdleTimeout(); + + /** + * Get the Write Timeout + * + * @return the write timeout + */ + Duration getWriteTimeout(); + + /** + * Set the Idle Timeout. + * + * @param timeout the timeout duration (timeout <= 0 implies an infinite timeout) + */ + void setIdleTimeout(Duration timeout); + + /** + * Set the Write Timeout. + * + * @param timeout the timeout duration (timeout <= 0 implies an infinite timeout) + */ + void setWriteTimeout(Duration timeout); + + boolean isAutoFragment(); + + void setAutoFragment(boolean autoFragment); + + long getMaxFrameSize(); + + void setMaxFrameSize(long maxFrameSize); + + int getOutputBufferSize(); + + void setOutputBufferSize(int outputBufferSize); + + int getInputBufferSize(); + + void setInputBufferSize(int inputBufferSize); + + long getMaxBinaryMessageSize(); + + void setMaxBinaryMessageSize(long maxSize); + + long getMaxTextMessageSize(); + + void setMaxTextMessageSize(long maxSize); + + interface Customizer + { + void customize(Configuration configurable); + } + + class ConfigurationHolder implements Configuration + { + protected Duration idleTimeout; + protected Duration writeTimeout; + protected Boolean autoFragment; + protected Long maxFrameSize; + protected Integer outputBufferSize; + protected Integer inputBufferSize; + protected Long maxBinaryMessageSize; + protected Long maxTextMessageSize; + + @Override + public Duration getIdleTimeout() + { + return idleTimeout == null ? WebSocketConstants.DEFAULT_IDLE_TIMEOUT : idleTimeout; + } + + @Override + public Duration getWriteTimeout() + { + return writeTimeout == null ? WebSocketConstants.DEFAULT_WRITE_TIMEOUT : writeTimeout; + } + + @Override + public void setIdleTimeout(Duration timeout) + { + this.idleTimeout = timeout; + } + + @Override + public void setWriteTimeout(Duration timeout) + { + this.writeTimeout = timeout; + } + + @Override + public boolean isAutoFragment() + { + return autoFragment == null ? WebSocketConstants.DEFAULT_AUTO_FRAGMENT : autoFragment; + } + + @Override + public void setAutoFragment(boolean autoFragment) + { + this.autoFragment = autoFragment; + } + + @Override + public long getMaxFrameSize() + { + return maxFrameSize == null ? WebSocketConstants.DEFAULT_MAX_FRAME_SIZE : maxFrameSize; + } + + @Override + public void setMaxFrameSize(long maxFrameSize) + { + this.maxFrameSize = maxFrameSize; + } + + @Override + public int getOutputBufferSize() + { + return outputBufferSize == null ? WebSocketConstants.DEFAULT_OUTPUT_BUFFER_SIZE : outputBufferSize; + } + + @Override + public void setOutputBufferSize(int outputBufferSize) + { + this.outputBufferSize = outputBufferSize; + } + + @Override + public int getInputBufferSize() + { + return inputBufferSize == null ? WebSocketConstants.DEFAULT_INPUT_BUFFER_SIZE : inputBufferSize; + } + + @Override + public void setInputBufferSize(int inputBufferSize) + { + this.inputBufferSize = inputBufferSize; + } + + @Override + public long getMaxBinaryMessageSize() + { + return maxBinaryMessageSize == null ? WebSocketConstants.DEFAULT_MAX_BINARY_MESSAGE_SIZE : maxBinaryMessageSize; + } + + @Override + public void setMaxBinaryMessageSize(long maxBinaryMessageSize) + { + this.maxBinaryMessageSize = maxBinaryMessageSize; + } + + @Override + public long getMaxTextMessageSize() + { + return maxTextMessageSize == null ? WebSocketConstants.DEFAULT_MAX_TEXT_MESSAGE_SIZE : maxTextMessageSize; + } + + @Override + public void setMaxTextMessageSize(long maxTextMessageSize) + { + this.maxTextMessageSize = maxTextMessageSize; + } + } + + class ConfigurationCustomizer extends ConfigurationHolder implements Customizer + { + @Override + public void customize(Configuration configurable) + { + if (idleTimeout != null) + configurable.setIdleTimeout(idleTimeout); + if (writeTimeout != null) + configurable.setWriteTimeout(writeTimeout); + if (autoFragment != null) + configurable.setAutoFragment(autoFragment); + if (maxFrameSize != null) + configurable.setMaxFrameSize(maxFrameSize); + if (inputBufferSize != null) + configurable.setInputBufferSize(inputBufferSize); + if (outputBufferSize != null) + configurable.setOutputBufferSize(outputBufferSize); + if (maxBinaryMessageSize != null) + configurable.setMaxBinaryMessageSize(maxBinaryMessageSize); + if (maxTextMessageSize != null) + configurable.setMaxTextMessageSize(maxTextMessageSize); + } + + public static ConfigurationCustomizer from(ConfigurationCustomizer parent, ConfigurationCustomizer child) + { + ConfigurationCustomizer customizer = new ConfigurationCustomizer(); + parent.customize(customizer); + child.customize(customizer); + return customizer; + } + } +} diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/CoreSession.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/CoreSession.java new file mode 100644 index 00000000000..7104323e60a --- /dev/null +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/CoreSession.java @@ -0,0 +1,266 @@ +// +// ======================================================================== +// Copyright (c) 1995-2019 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.core; + +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.net.URI; +import java.util.List; +import java.util.Map; + +import org.eclipse.jetty.io.ByteBufferPool; +import org.eclipse.jetty.util.Callback; + +/** + * Represents the outgoing Frames. + */ +public interface CoreSession extends OutgoingFrames, Configuration +{ + /** + * The negotiated WebSocket Sub-Protocol for this session. + * + * @return the negotiated WebSocket Sub-Protocol for this session. + */ + String getNegotiatedSubProtocol(); + + /** + * The negotiated WebSocket Extension Configurations for this session. + * + * @return the list of Negotiated Extension Configurations for this session. + */ + List getNegotiatedExtensions(); + + /** + * The parameter map (from URI Query) for the active session. + * + * @return the immutable map of parameters + */ + Map> getParameterMap(); + + /** + * The active {@code Sec-WebSocket-Version} (protocol version) in use. + * + * @return the protocol version in use. + */ + String getProtocolVersion(); + + /** + * The active connection's Request URI. + * This is the URI of the upgrade request and is typically http: or https: rather than + * the ws: or wss: scheme. + * + * @return the absolute URI (including Query string) + */ + URI getRequestURI(); + + /** + * The active connection's Secure status indicator. + * + * @return true if connection is secure (similar in role to {@code HttpServletRequest.isSecure()}) + */ + boolean isSecure(); + + /** + * @return Client or Server behaviour + */ + Behavior getBehavior(); + + /** + * @return The shared ByteBufferPool + */ + ByteBufferPool getByteBufferPool(); + + /** + * The Local Socket Address for the connection + *

+ * Do not assume that this will return a {@link InetSocketAddress} in all cases. + * Use of various proxies, and even UnixSockets can result a SocketAddress being returned + * without supporting {@link InetSocketAddress} + *

+ * + * @return the SocketAddress for the local connection, or null if not supported by Session + */ + SocketAddress getLocalAddress(); + + /** + * The Remote Socket Address for the connection + *

+ * Do not assume that this will return a {@link InetSocketAddress} in all cases. + * Use of various proxies, and even UnixSockets can result a SocketAddress being returned + * without supporting {@link InetSocketAddress} + *

+ * + * @return the SocketAddress for the remote connection, or null if not supported by Session + */ + SocketAddress getRemoteAddress(); + + /** + * @return True if the websocket is open outbound + */ + boolean isOutputOpen(); + + /** + * If using BatchMode.ON or BatchMode.AUTO, trigger a flush of enqueued / batched frames. + * + * @param callback the callback to track close frame sent (or failed) + */ + void flush(Callback callback); + + /** + * Initiate close handshake, no payload (no declared status code or reason phrase) + * + * @param callback the callback to track close frame sent (or failed) + */ + void close(Callback callback); + + /** + * Initiate close handshake with provide status code and optional reason phrase. + * + * @param statusCode the status code (should be a valid status code that can be sent) + * @param reason optional reason phrase (will be truncated automatically by implementation to fit within limits of protocol) + * @param callback the callback to track close frame sent (or failed) + */ + void close(int statusCode, String reason, Callback callback); + + /** + * Issue a harsh abort of the underlying connection. + *

+ * This will terminate the connection, without sending a websocket close frame. + * No WebSocket Protocol close handshake will be performed. + *

+ *

+ * Once called, any read/write activity on the websocket from this point will be indeterminate. + * This can result in the {@link FrameHandler#onError(Throwable, Callback)} event being called indicating any issue that arises. + *

+ *

+ * Once the underlying connection has been determined to be closed, the {@link FrameHandler#onClosed(CloseStatus, Callback)} event will be called. + *

+ */ + void abort(); + + /** + * Manage flow control by indicating demand for handling Frames. A call to + * {@link FrameHandler#onFrame(Frame, Callback)} will only be made if a + * corresponding demand has been signaled. It is an error to call this method + * if {@link FrameHandler#isDemanding()} returns false. + * + * @param n The number of frames that can be handled (in sequential calls to + * {@link FrameHandler#onFrame(Frame, Callback)}). May not be negative. + */ + void demand(long n); + + class Empty extends ConfigurationCustomizer implements CoreSession + { + @Override + public String getNegotiatedSubProtocol() + { + return null; + } + + @Override + public List getNegotiatedExtensions() + { + return null; + } + + @Override + public Map> getParameterMap() + { + return null; + } + + @Override + public String getProtocolVersion() + { + return null; + } + + @Override + public URI getRequestURI() + { + return null; + } + + @Override + public boolean isSecure() + { + return false; + } + + @Override + public void abort() + { + } + + @Override + public Behavior getBehavior() + { + return null; + } + + @Override + public ByteBufferPool getByteBufferPool() + { + return null; + } + + @Override + public SocketAddress getLocalAddress() + { + return null; + } + + @Override + public SocketAddress getRemoteAddress() + { + return null; + } + + @Override + public boolean isOutputOpen() + { + return false; + } + + @Override + public void flush(Callback callback) + { + } + + @Override + public void close(Callback callback) + { + } + + @Override + public void close(int statusCode, String reason, Callback callback) + { + } + + @Override + public void demand(long n) + { + } + + @Override + public void sendFrame(Frame frame, Callback callback, boolean batch) + { + } + } +} diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/Extension.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/Extension.java index 0d97a2be44c..2bbab07de88 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/Extension.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/Extension.java @@ -18,8 +18,6 @@ package org.eclipse.jetty.websocket.core; -import org.eclipse.jetty.websocket.core.FrameHandler.Configuration; - /** * Interface for WebSocket Extensions. *

diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/FrameHandler.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/FrameHandler.java index 16fd5bcc3a1..37b3f9181b6 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/FrameHandler.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/FrameHandler.java @@ -18,14 +18,6 @@ package org.eclipse.jetty.websocket.core; -import java.net.InetSocketAddress; -import java.net.SocketAddress; -import java.net.URI; -import java.time.Duration; -import java.util.List; -import java.util.Map; - -import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.websocket.core.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.core.server.Negotiation; @@ -129,443 +121,4 @@ public interface FrameHandler extends IncomingFrames { return false; } - - interface Configuration - { - - /** - * Get the Idle Timeout - * - * @return the idle timeout - */ - Duration getIdleTimeout(); - - /** - * Get the Write Timeout - * - * @return the write timeout - */ - Duration getWriteTimeout(); - - /** - * Set the Idle Timeout. - * - * @param timeout the timeout duration (timeout <= 0 implies an infinite timeout) - */ - void setIdleTimeout(Duration timeout); - - /** - * Set the Write Timeout. - * - * @param timeout the timeout duration (timeout <= 0 implies an infinite timeout) - */ - void setWriteTimeout(Duration timeout); - - boolean isAutoFragment(); - - void setAutoFragment(boolean autoFragment); - - long getMaxFrameSize(); - - void setMaxFrameSize(long maxFrameSize); - - int getOutputBufferSize(); - - void setOutputBufferSize(int outputBufferSize); - - int getInputBufferSize(); - - void setInputBufferSize(int inputBufferSize); - - long getMaxBinaryMessageSize(); - - void setMaxBinaryMessageSize(long maxSize); - - long getMaxTextMessageSize(); - - void setMaxTextMessageSize(long maxSize); - } - - /** - * Represents the outgoing Frames. - */ - interface CoreSession extends OutgoingFrames, Configuration - { - /** - * The negotiated WebSocket Sub-Protocol for this session. - * - * @return the negotiated WebSocket Sub-Protocol for this session. - */ - String getNegotiatedSubProtocol(); - - /** - * The negotiated WebSocket Extension Configurations for this session. - * - * @return the list of Negotiated Extension Configurations for this session. - */ - List getNegotiatedExtensions(); - - /** - * The parameter map (from URI Query) for the active session. - * - * @return the immutable map of parameters - */ - Map> getParameterMap(); - - /** - * The active {@code Sec-WebSocket-Version} (protocol version) in use. - * - * @return the protocol version in use. - */ - String getProtocolVersion(); - - /** - * The active connection's Request URI. - * This is the URI of the upgrade request and is typically http: or https: rather than - * the ws: or wss: scheme. - * - * @return the absolute URI (including Query string) - */ - URI getRequestURI(); - - /** - * The active connection's Secure status indicator. - * - * @return true if connection is secure (similar in role to {@code HttpServletRequest.isSecure()}) - */ - boolean isSecure(); - - /** - * @return Client or Server behaviour - */ - Behavior getBehavior(); - - /** - * @return The shared ByteBufferPool - */ - ByteBufferPool getByteBufferPool(); - - /** - * The Local Socket Address for the connection - *

- * Do not assume that this will return a {@link InetSocketAddress} in all cases. - * Use of various proxies, and even UnixSockets can result a SocketAddress being returned - * without supporting {@link InetSocketAddress} - *

- * - * @return the SocketAddress for the local connection, or null if not supported by Session - */ - SocketAddress getLocalAddress(); - - /** - * The Remote Socket Address for the connection - *

- * Do not assume that this will return a {@link InetSocketAddress} in all cases. - * Use of various proxies, and even UnixSockets can result a SocketAddress being returned - * without supporting {@link InetSocketAddress} - *

- * - * @return the SocketAddress for the remote connection, or null if not supported by Session - */ - SocketAddress getRemoteAddress(); - - /** - * @return True if the websocket is open outbound - */ - boolean isOutputOpen(); - - /** - * If using BatchMode.ON or BatchMode.AUTO, trigger a flush of enqueued / batched frames. - * - * @param callback the callback to track close frame sent (or failed) - */ - void flush(Callback callback); - - /** - * Initiate close handshake, no payload (no declared status code or reason phrase) - * - * @param callback the callback to track close frame sent (or failed) - */ - void close(Callback callback); - - /** - * Initiate close handshake with provide status code and optional reason phrase. - * - * @param statusCode the status code (should be a valid status code that can be sent) - * @param reason optional reason phrase (will be truncated automatically by implementation to fit within limits of protocol) - * @param callback the callback to track close frame sent (or failed) - */ - void close(int statusCode, String reason, Callback callback); - - /** - * Issue a harsh abort of the underlying connection. - *

- * This will terminate the connection, without sending a websocket close frame. - * No WebSocket Protocol close handshake will be performed. - *

- *

- * Once called, any read/write activity on the websocket from this point will be indeterminate. - * This can result in the {@link #onError(Throwable, Callback)} event being called indicating any issue that arises. - *

- *

- * Once the underlying connection has been determined to be closed, the {@link #onClosed(CloseStatus, Callback)} event will be called. - *

- */ - void abort(); - - /** - * Manage flow control by indicating demand for handling Frames. A call to - * {@link FrameHandler#onFrame(Frame, Callback)} will only be made if a - * corresponding demand has been signaled. It is an error to call this method - * if {@link FrameHandler#isDemanding()} returns false. - * - * @param n The number of frames that can be handled (in sequential calls to - * {@link FrameHandler#onFrame(Frame, Callback)}). May not be negative. - */ - void demand(long n); - - class Empty extends ConfigurationCustomizer implements CoreSession - { - @Override - public String getNegotiatedSubProtocol() - { - return null; - } - - @Override - public List getNegotiatedExtensions() - { - return null; - } - - @Override - public Map> getParameterMap() - { - return null; - } - - @Override - public String getProtocolVersion() - { - return null; - } - - @Override - public URI getRequestURI() - { - return null; - } - - @Override - public boolean isSecure() - { - return false; - } - - @Override - public void abort() - { - } - - @Override - public Behavior getBehavior() - { - return null; - } - - @Override - public ByteBufferPool getByteBufferPool() - { - return null; - } - - @Override - public SocketAddress getLocalAddress() - { - return null; - } - - @Override - public SocketAddress getRemoteAddress() - { - return null; - } - - @Override - public boolean isOutputOpen() - { - return false; - } - - @Override - public void flush(Callback callback) - { - } - - @Override - public void close(Callback callback) - { - } - - @Override - public void close(int statusCode, String reason, Callback callback) - { - } - - @Override - public void demand(long n) - { - } - - @Override - public void sendFrame(Frame frame, Callback callback, boolean batch) - { - } - } - } - - interface Customizer - { - void customize(Configuration configurable); - } - - class ConfigurationHolder implements Configuration - { - protected Duration idleTimeout; - protected Duration writeTimeout; - protected Boolean autoFragment; - protected Long maxFrameSize; - protected Integer outputBufferSize; - protected Integer inputBufferSize; - protected Long maxBinaryMessageSize; - protected Long maxTextMessageSize; - - @Override - public Duration getIdleTimeout() - { - return idleTimeout == null ? WebSocketConstants.DEFAULT_IDLE_TIMEOUT : idleTimeout; - } - - @Override - public Duration getWriteTimeout() - { - return writeTimeout == null ? WebSocketConstants.DEFAULT_WRITE_TIMEOUT : writeTimeout; - } - - @Override - public void setIdleTimeout(Duration timeout) - { - this.idleTimeout = timeout; - } - - @Override - public void setWriteTimeout(Duration timeout) - { - this.writeTimeout = timeout; - } - - @Override - public boolean isAutoFragment() - { - return autoFragment == null ? WebSocketConstants.DEFAULT_AUTO_FRAGMENT : autoFragment; - } - - @Override - public void setAutoFragment(boolean autoFragment) - { - this.autoFragment = autoFragment; - } - - @Override - public long getMaxFrameSize() - { - return maxFrameSize == null ? WebSocketConstants.DEFAULT_MAX_FRAME_SIZE : maxFrameSize; - } - - @Override - public void setMaxFrameSize(long maxFrameSize) - { - this.maxFrameSize = maxFrameSize; - } - - @Override - public int getOutputBufferSize() - { - return outputBufferSize == null ? WebSocketConstants.DEFAULT_OUTPUT_BUFFER_SIZE : outputBufferSize; - } - - @Override - public void setOutputBufferSize(int outputBufferSize) - { - this.outputBufferSize = outputBufferSize; - } - - @Override - public int getInputBufferSize() - { - return inputBufferSize == null ? WebSocketConstants.DEFAULT_INPUT_BUFFER_SIZE : inputBufferSize; - } - - @Override - public void setInputBufferSize(int inputBufferSize) - { - this.inputBufferSize = inputBufferSize; - } - - @Override - public long getMaxBinaryMessageSize() - { - return maxBinaryMessageSize == null ? WebSocketConstants.DEFAULT_MAX_BINARY_MESSAGE_SIZE : maxBinaryMessageSize; - } - - @Override - public void setMaxBinaryMessageSize(long maxBinaryMessageSize) - { - this.maxBinaryMessageSize = maxBinaryMessageSize; - } - - @Override - public long getMaxTextMessageSize() - { - return maxTextMessageSize == null ? WebSocketConstants.DEFAULT_MAX_TEXT_MESSAGE_SIZE : maxTextMessageSize; - } - - @Override - public void setMaxTextMessageSize(long maxTextMessageSize) - { - this.maxTextMessageSize = maxTextMessageSize; - } - } - - class ConfigurationCustomizer extends ConfigurationHolder implements Customizer - { - @Override - public void customize(Configuration configurable) - { - if (idleTimeout != null) - configurable.setIdleTimeout(idleTimeout); - if (writeTimeout != null) - configurable.setWriteTimeout(idleTimeout); - if (autoFragment != null) - configurable.setAutoFragment(autoFragment); - if (maxFrameSize != null) - configurable.setMaxFrameSize(maxFrameSize); - if (inputBufferSize != null) - configurable.setInputBufferSize(inputBufferSize); - if (outputBufferSize != null) - configurable.setOutputBufferSize(outputBufferSize); - if (maxBinaryMessageSize != null) - configurable.setMaxBinaryMessageSize(maxBinaryMessageSize); - if (maxTextMessageSize != null) - configurable.setMaxTextMessageSize(maxTextMessageSize); - } - - public static ConfigurationCustomizer from(ConfigurationCustomizer parent, ConfigurationCustomizer child) - { - ConfigurationCustomizer customizer = new ConfigurationCustomizer(); - parent.customize(customizer); - child.customize(customizer); - return customizer; - } - } } diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/MessageHandler.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/MessageHandler.java index 86d962b5f2e..cfd9fe21e64 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/MessageHandler.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/MessageHandler.java @@ -29,13 +29,15 @@ import org.eclipse.jetty.util.Utf8Appendable; import org.eclipse.jetty.util.Utf8StringBuilder; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.core.exception.BadPayloadException; +import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException; /** * A utility implementation of FrameHandler that defragments * text frames into a String message before calling {@link #onText(String, Callback)}. * Flow control is by default automatic, but an implementation * may extend {@link #isDemanding()} to return true and then explicityly control - * demand with calls to {@link org.eclipse.jetty.websocket.core.FrameHandler.CoreSession#demand(long)} + * demand with calls to {@link CoreSession#demand(long)} */ public class MessageHandler implements FrameHandler { diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/ClientUpgradeRequest.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/ClientUpgradeRequest.java index 566f9961d87..098fb00060b 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/ClientUpgradeRequest.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/ClientUpgradeRequest.java @@ -50,11 +50,13 @@ import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.core.Behavior; +import org.eclipse.jetty.websocket.core.Configuration; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.ExtensionConfig; import org.eclipse.jetty.websocket.core.FrameHandler; -import org.eclipse.jetty.websocket.core.UpgradeException; +import org.eclipse.jetty.websocket.core.exception.UpgradeException; import org.eclipse.jetty.websocket.core.WebSocketConstants; -import org.eclipse.jetty.websocket.core.WebSocketException; +import org.eclipse.jetty.websocket.core.exception.WebSocketException; import org.eclipse.jetty.websocket.core.internal.ExtensionStack; import org.eclipse.jetty.websocket.core.internal.Negotiated; import org.eclipse.jetty.websocket.core.internal.WebSocketConnection; @@ -75,10 +77,10 @@ public abstract class ClientUpgradeRequest extends HttpRequest implements Respon } private static final Logger LOG = Log.getLogger(ClientUpgradeRequest.class); - protected final CompletableFuture futureCoreSession; + protected final CompletableFuture futureCoreSession; private final WebSocketCoreClient wsClient; private FrameHandler frameHandler; - private FrameHandler.ConfigurationCustomizer customizer = new FrameHandler.ConfigurationCustomizer(); + private Configuration.ConfigurationCustomizer customizer = new Configuration.ConfigurationCustomizer(); private List upgradeListeners = new ArrayList<>(); private List requestedExtensions = new ArrayList<>(); @@ -112,7 +114,7 @@ public abstract class ClientUpgradeRequest extends HttpRequest implements Respon this.futureCoreSession = new CompletableFuture<>(); } - public void setConfiguration(FrameHandler.ConfigurationCustomizer config) + public void setConfiguration(Configuration.ConfigurationCustomizer config) { config.customize(customizer); } @@ -187,7 +189,7 @@ public abstract class ClientUpgradeRequest extends HttpRequest implements Respon super.send(listener); } - public CompletableFuture sendAsync() + public CompletableFuture sendAsync() { send(this); return futureCoreSession; diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/WebSocketCoreClient.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/WebSocketCoreClient.java index 1c89cdcc871..b64223a5e6f 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/WebSocketCoreClient.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/WebSocketCoreClient.java @@ -28,6 +28,7 @@ import org.eclipse.jetty.util.DecoratedObjectFactory; import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.ExtensionConfig; import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.WebSocketComponents; @@ -68,13 +69,13 @@ public class WebSocketCoreClient extends ContainerLifeCycle addBean(httpClient); } - public CompletableFuture connect(FrameHandler frameHandler, URI wsUri) throws IOException + public CompletableFuture connect(FrameHandler frameHandler, URI wsUri) throws IOException { ClientUpgradeRequest request = ClientUpgradeRequest.from(this, wsUri, frameHandler); return connect(request); } - public CompletableFuture connect(ClientUpgradeRequest request) throws IOException + public CompletableFuture connect(ClientUpgradeRequest request) throws IOException { if (!isStarted()) throw new IllegalStateException(WebSocketCoreClient.class.getSimpleName() + "@" + this.hashCode() + " is not started"); diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/BadPayloadException.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/BadPayloadException.java similarity index 93% rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/BadPayloadException.java rename to jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/BadPayloadException.java index d0cfdae380b..1d184674615 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/BadPayloadException.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/BadPayloadException.java @@ -16,7 +16,9 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core; +package org.eclipse.jetty.websocket.core.exception; + +import org.eclipse.jetty.websocket.core.CloseStatus; /** * Exception to terminate the connection because it has received data within a frame payload that was not consistent with the requirements of that frame diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/CloseException.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/CloseException.java similarity index 96% rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/CloseException.java rename to jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/CloseException.java index a28f7a5fb08..e7a85c8ff0f 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/CloseException.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/CloseException.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core; +package org.eclipse.jetty.websocket.core.exception; @SuppressWarnings("serial") public class CloseException extends WebSocketException diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/MessageTooLargeException.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/MessageTooLargeException.java similarity index 93% rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/MessageTooLargeException.java rename to jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/MessageTooLargeException.java index b6e8ff47f48..51bdf3c35b0 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/MessageTooLargeException.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/MessageTooLargeException.java @@ -16,7 +16,9 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core; +package org.eclipse.jetty.websocket.core.exception; + +import org.eclipse.jetty.websocket.core.CloseStatus; /** * Exception when a message is too large for the internal buffers occurs and should trigger a connection close. diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/ProtocolException.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/ProtocolException.java similarity index 92% rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/ProtocolException.java rename to jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/ProtocolException.java index 9aa97fa98d0..d5d9e1fab59 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/ProtocolException.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/ProtocolException.java @@ -16,7 +16,9 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core; +package org.eclipse.jetty.websocket.core.exception; + +import org.eclipse.jetty.websocket.core.CloseStatus; /** * Per spec, a protocol error should result in a Close frame of status code 1002 (PROTOCOL_ERROR) diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/UpgradeException.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/UpgradeException.java similarity index 97% rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/UpgradeException.java rename to jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/UpgradeException.java index 6ad3b78c200..da4428ebca9 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/UpgradeException.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/UpgradeException.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core; +package org.eclipse.jetty.websocket.core.exception; import java.net.URI; diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketException.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketException.java similarity index 96% rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketException.java rename to jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketException.java index 2da71d2f94d..1239f1d7e3c 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketException.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketException.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core; +package org.eclipse.jetty.websocket.core.exception; /** * A recoverable exception within the websocket framework. diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketTimeoutException.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketTimeoutException.java similarity index 96% rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketTimeoutException.java rename to jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketTimeoutException.java index 8dcfab5b104..4f96a86f9b0 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketTimeoutException.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketTimeoutException.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core; +package org.eclipse.jetty.websocket.core.exception; /** * Exception thrown to indicate a connection I/O timeout. diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketWriteTimeoutException.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketWriteTimeoutException.java similarity index 94% rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketWriteTimeoutException.java rename to jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketWriteTimeoutException.java index 2dabed13133..c4b885e7dd5 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/WebSocketWriteTimeoutException.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/exception/WebSocketWriteTimeoutException.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core; +package org.eclipse.jetty.websocket.core.exception; public class WebSocketWriteTimeoutException extends WebSocketTimeoutException { diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ExtensionStack.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ExtensionStack.java index e9784c01a60..2632fb6d264 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ExtensionStack.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ExtensionStack.java @@ -39,7 +39,7 @@ import org.eclipse.jetty.websocket.core.Frame; import org.eclipse.jetty.websocket.core.IncomingFrames; import org.eclipse.jetty.websocket.core.OutgoingFrames; import org.eclipse.jetty.websocket.core.WebSocketComponents; -import org.eclipse.jetty.websocket.core.WebSocketException; +import org.eclipse.jetty.websocket.core.exception.WebSocketException; /** * Represents the stack of Extensions. diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentExtension.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentExtension.java index 5f481d800d4..22231c1a9a5 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentExtension.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentExtension.java @@ -22,9 +22,9 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.core.AbstractExtension; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.ExtensionConfig; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.WebSocketComponents; /** @@ -35,7 +35,7 @@ public class FragmentExtension extends AbstractExtension private static final Logger LOG = Log.getLogger(FragmentExtension.class); private final FragmentingFlusher flusher; - private final FrameHandler.Configuration configuration = new FrameHandler.ConfigurationHolder(); + private final Configuration configuration = new Configuration.ConfigurationHolder(); public FragmentExtension() { diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentingFlusher.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentingFlusher.java index 520b4c508fb..464acff2c69 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentingFlusher.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FragmentingFlusher.java @@ -24,7 +24,7 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler.Configuration; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.OpCode; /** diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java index d9538973363..ac0169b89cc 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java @@ -41,8 +41,8 @@ import org.eclipse.jetty.util.thread.Scheduler; import org.eclipse.jetty.websocket.core.CloseStatus; import org.eclipse.jetty.websocket.core.Frame; import org.eclipse.jetty.websocket.core.OpCode; -import org.eclipse.jetty.websocket.core.WebSocketException; -import org.eclipse.jetty.websocket.core.WebSocketWriteTimeoutException; +import org.eclipse.jetty.websocket.core.exception.WebSocketException; +import org.eclipse.jetty.websocket.core.exception.WebSocketWriteTimeoutException; public class FrameFlusher extends IteratingCallback { diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameSequence.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameSequence.java index 7e2ed5f805a..812a992abe5 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameSequence.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameSequence.java @@ -19,7 +19,7 @@ package org.eclipse.jetty.websocket.core.internal; import org.eclipse.jetty.websocket.core.OpCode; -import org.eclipse.jetty.websocket.core.ProtocolException; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; public class FrameSequence { diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/NullAppendable.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/NullAppendable.java similarity index 96% rename from jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/NullAppendable.java rename to jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/NullAppendable.java index 6dde40e4d7a..769fed304b2 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/NullAppendable.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/NullAppendable.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.core; +package org.eclipse.jetty.websocket.core.internal; import org.eclipse.jetty.util.Utf8Appendable; diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/Parser.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/Parser.java index 486aaaffbbc..e63e17a8f6a 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/Parser.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/Parser.java @@ -28,12 +28,12 @@ import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.core.CloseStatus; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler.Configuration; -import org.eclipse.jetty.websocket.core.FrameHandler.ConfigurationHolder; -import org.eclipse.jetty.websocket.core.MessageTooLargeException; +import org.eclipse.jetty.websocket.core.Configuration; +import org.eclipse.jetty.websocket.core.Configuration.ConfigurationHolder; +import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException; import org.eclipse.jetty.websocket.core.OpCode; -import org.eclipse.jetty.websocket.core.ProtocolException; -import org.eclipse.jetty.websocket.core.WebSocketException; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; +import org.eclipse.jetty.websocket.core.exception.WebSocketException; /** * Parsing of a frames in WebSocket land. diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/PerMessageDeflateExtension.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/PerMessageDeflateExtension.java index 90e333c9c10..c9fea2a1ea7 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/PerMessageDeflateExtension.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/PerMessageDeflateExtension.java @@ -30,12 +30,12 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.core.AbstractExtension; -import org.eclipse.jetty.websocket.core.BadPayloadException; +import org.eclipse.jetty.websocket.core.exception.BadPayloadException; import org.eclipse.jetty.websocket.core.ExtensionConfig; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.MessageTooLargeException; +import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException; import org.eclipse.jetty.websocket.core.OpCode; -import org.eclipse.jetty.websocket.core.ProtocolException; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; import org.eclipse.jetty.websocket.core.WebSocketComponents; /** diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ValidationExtension.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ValidationExtension.java index bbce3306a04..c2d2689fcaf 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ValidationExtension.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ValidationExtension.java @@ -24,11 +24,10 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.core.AbstractExtension; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.ExtensionConfig; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; -import org.eclipse.jetty.websocket.core.NullAppendable; -import org.eclipse.jetty.websocket.core.ProtocolException; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; import org.eclipse.jetty.websocket.core.WebSocketComponents; import static org.eclipse.jetty.websocket.core.OpCode.CONTINUATION; @@ -56,7 +55,7 @@ public class ValidationExtension extends AbstractExtension } @Override - public void setConfiguration(FrameHandler.Configuration configuration) + public void setConfiguration(Configuration configuration) { super.setConfiguration(configuration); diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java index 9b7d6766788..0438cc0199a 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java @@ -39,7 +39,7 @@ import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.thread.Scheduler; import org.eclipse.jetty.websocket.core.Behavior; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.WebSocketTimeoutException; +import org.eclipse.jetty.websocket.core.exception.WebSocketTimeoutException; /** * Provides the implementation of {@link org.eclipse.jetty.io.Connection} that is suitable for WebSocket diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCoreSession.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCoreSession.java index 1ed5fc8590f..ad76f095f31 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCoreSession.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketCoreSession.java @@ -36,19 +36,21 @@ import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.core.Behavior; -import org.eclipse.jetty.websocket.core.CloseException; +import org.eclipse.jetty.websocket.core.Configuration; +import org.eclipse.jetty.websocket.core.CoreSession; +import org.eclipse.jetty.websocket.core.exception.CloseException; import org.eclipse.jetty.websocket.core.CloseStatus; import org.eclipse.jetty.websocket.core.ExtensionConfig; import org.eclipse.jetty.websocket.core.Frame; import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.IncomingFrames; -import org.eclipse.jetty.websocket.core.MessageTooLargeException; +import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.OutgoingFrames; -import org.eclipse.jetty.websocket.core.ProtocolException; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; import org.eclipse.jetty.websocket.core.WebSocketConstants; -import org.eclipse.jetty.websocket.core.WebSocketTimeoutException; -import org.eclipse.jetty.websocket.core.WebSocketWriteTimeoutException; +import org.eclipse.jetty.websocket.core.exception.WebSocketTimeoutException; +import org.eclipse.jetty.websocket.core.exception.WebSocketWriteTimeoutException; import org.eclipse.jetty.websocket.core.internal.Parser.ParsedFrame; import static org.eclipse.jetty.util.Callback.NOOP; @@ -56,7 +58,7 @@ import static org.eclipse.jetty.util.Callback.NOOP; /** * The Core WebSocket Session. */ -public class WebSocketCoreSession implements IncomingFrames, FrameHandler.CoreSession, Dumpable +public class WebSocketCoreSession implements IncomingFrames, CoreSession, Dumpable { private static final Logger LOG = Log.getLogger(WebSocketCoreSession.class); private static final CloseStatus NO_CODE = new CloseStatus(CloseStatus.NO_CODE); @@ -809,7 +811,7 @@ public class WebSocketCoreSession implements IncomingFrames, FrameHandler.CoreSe private class Flusher extends FragmentingFlusher { - public Flusher(FrameHandler.Configuration configuration) + public Flusher(Configuration configuration) { super(configuration); } diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketSessionState.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketSessionState.java index acb18f801ab..4da7a78cce4 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketSessionState.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketSessionState.java @@ -23,7 +23,7 @@ import java.nio.channels.ClosedChannelException; import org.eclipse.jetty.websocket.core.CloseStatus; import org.eclipse.jetty.websocket.core.Frame; import org.eclipse.jetty.websocket.core.OpCode; -import org.eclipse.jetty.websocket.core.ProtocolException; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; /** * Atomic Connection State diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/Handshaker.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/Handshaker.java index 88a2fff7368..c6644587257 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/Handshaker.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/Handshaker.java @@ -22,7 +22,7 @@ import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.server.internal.HandshakerSelector; public interface Handshaker @@ -32,5 +32,5 @@ public interface Handshaker return new HandshakerSelector(); } - boolean upgradeRequest(WebSocketNegotiator negotiator, HttpServletRequest request, HttpServletResponse response, FrameHandler.Customizer defaultCustomizer) throws IOException; + boolean upgradeRequest(WebSocketNegotiator negotiator, HttpServletRequest request, HttpServletResponse response, Configuration.Customizer defaultCustomizer) throws IOException; } diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketNegotiator.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketNegotiator.java index e02a110dc76..962f28be9de 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketNegotiator.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketNegotiator.java @@ -23,11 +23,12 @@ import java.util.function.Function; import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.DecoratedObjectFactory; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.WebSocketComponents; import org.eclipse.jetty.websocket.core.WebSocketExtensionRegistry; -public interface WebSocketNegotiator extends FrameHandler.Customizer +public interface WebSocketNegotiator extends Configuration.Customizer { FrameHandler negotiate(Negotiation negotiation) throws IOException; @@ -51,7 +52,7 @@ public interface WebSocketNegotiator extends FrameHandler.Customizer }; } - static WebSocketNegotiator from(Function negotiate, FrameHandler.Customizer customizer) + static WebSocketNegotiator from(Function negotiate, Configuration.Customizer customizer) { return new AbstractNegotiator(null, customizer) { @@ -66,7 +67,7 @@ public interface WebSocketNegotiator extends FrameHandler.Customizer static WebSocketNegotiator from( Function negotiate, WebSocketComponents components, - FrameHandler.Customizer customizer) + Configuration.Customizer customizer) { return new AbstractNegotiator(components, customizer) { @@ -81,21 +82,21 @@ public interface WebSocketNegotiator extends FrameHandler.Customizer abstract class AbstractNegotiator implements WebSocketNegotiator { final WebSocketComponents components; - final FrameHandler.Customizer customizer; + final Configuration.Customizer customizer; public AbstractNegotiator() { this(null, null); } - public AbstractNegotiator(WebSocketComponents components, FrameHandler.Customizer customizer) + public AbstractNegotiator(WebSocketComponents components, Configuration.Customizer customizer) { this.components = components == null ? new WebSocketComponents() : components; this.customizer = customizer; } @Override - public void customize(FrameHandler.Configuration configurable) + public void customize(Configuration configurable) { if (customizer != null) customizer.customize(configurable); @@ -125,7 +126,7 @@ public interface WebSocketNegotiator extends FrameHandler.Customizer return components; } - public FrameHandler.Customizer getCustomizer() + public Configuration.Customizer getCustomizer() { return customizer; } diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/AbstractHandshaker.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/AbstractHandshaker.java index 61c6b2e3c58..8693dbe3585 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/AbstractHandshaker.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/AbstractHandshaker.java @@ -38,11 +38,12 @@ import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.thread.Scheduler; import org.eclipse.jetty.websocket.core.Behavior; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.ExtensionConfig; import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.WebSocketComponents; import org.eclipse.jetty.websocket.core.WebSocketConstants; -import org.eclipse.jetty.websocket.core.WebSocketException; +import org.eclipse.jetty.websocket.core.exception.WebSocketException; import org.eclipse.jetty.websocket.core.internal.ExtensionStack; import org.eclipse.jetty.websocket.core.internal.Negotiated; import org.eclipse.jetty.websocket.core.internal.WebSocketConnection; @@ -57,7 +58,7 @@ public abstract class AbstractHandshaker implements Handshaker private static final HttpField SERVER_VERSION = new PreEncodedHttpField(HttpHeader.SERVER, HttpConfiguration.SERVER_VERSION); @Override - public boolean upgradeRequest(WebSocketNegotiator negotiator, HttpServletRequest request, HttpServletResponse response, FrameHandler.Customizer defaultCustomizer) throws IOException + public boolean upgradeRequest(WebSocketNegotiator negotiator, HttpServletRequest request, HttpServletResponse response, Configuration.Customizer defaultCustomizer) throws IOException { if (!validateRequest(request)) return false; diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/HandshakerSelector.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/HandshakerSelector.java index 9fc54235365..1310298f9b8 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/HandshakerSelector.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/HandshakerSelector.java @@ -22,7 +22,7 @@ import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.server.Handshaker; import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator; @@ -37,7 +37,7 @@ public class HandshakerSelector implements Handshaker private final RFC8441Handshaker rfc8441 = new RFC8441Handshaker(); @Override - public boolean upgradeRequest(WebSocketNegotiator negotiator, HttpServletRequest request, HttpServletResponse response, FrameHandler.Customizer defaultCustomizer) throws IOException + public boolean upgradeRequest(WebSocketNegotiator negotiator, HttpServletRequest request, HttpServletResponse response, Configuration.Customizer defaultCustomizer) throws IOException { // Try HTTP/1.1 WS upgrade, if this fails try an HTTP/2 WS upgrade if no response was committed. return rfc6455.upgradeRequest(negotiator, request, response, defaultCustomizer) || diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/AutoFragmentTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/AutoFragmentTest.java index db05b7180b5..1cde7b9a5dd 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/AutoFragmentTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/AutoFragmentTest.java @@ -74,7 +74,7 @@ public class AutoFragmentTest public void testOutgoingAutoFragmentToMaxFrameSize() throws Exception { TestFrameHandler clientHandler = new TestFrameHandler(); - CompletableFuture connect = client.connect(clientHandler, serverUri); + CompletableFuture connect = client.connect(clientHandler, serverUri); connect.get(5, TimeUnit.SECONDS); // Turn off fragmentation on the server. @@ -122,7 +122,7 @@ public class AutoFragmentTest public void testIncomingAutoFragmentToMaxFrameSize() throws Exception { TestFrameHandler clientHandler = new TestFrameHandler(); - CompletableFuture connect = client.connect(clientHandler, serverUri); + CompletableFuture connect = client.connect(clientHandler, serverUri); connect.get(5, TimeUnit.SECONDS); // Turn off fragmentation on the client. @@ -167,7 +167,7 @@ public class AutoFragmentTest TestFrameHandler clientHandler = new TestFrameHandler(); ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(client, serverUri, clientHandler); upgradeRequest.addExtensions("permessage-deflate"); - CompletableFuture connect = client.connect(upgradeRequest); + CompletableFuture connect = client.connect(upgradeRequest); connect.get(5, TimeUnit.SECONDS); // Turn off fragmentation on the client. @@ -218,7 +218,7 @@ public class AutoFragmentTest TestFrameHandler clientHandler = new TestFrameHandler(); ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(client, serverUri, clientHandler); upgradeRequest.addExtensions("permessage-deflate"); - CompletableFuture connect = client.connect(upgradeRequest); + CompletableFuture connect = client.connect(upgradeRequest); connect.get(5, TimeUnit.SECONDS); // Turn off fragmentation on the client. @@ -282,7 +282,7 @@ public class AutoFragmentTest TestFrameHandler clientHandler = new TestFrameHandler(); ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(client, serverUri, clientHandler); upgradeRequest.addExtensions("permessage-deflate"); - CompletableFuture connect = client.connect(upgradeRequest); + CompletableFuture connect = client.connect(upgradeRequest); connect.get(5, TimeUnit.SECONDS); // Turn off fragmentation on the client. diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/FrameBufferTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/FrameBufferTest.java index 19e440f8dd0..da8ee33408b 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/FrameBufferTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/FrameBufferTest.java @@ -26,7 +26,6 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; -import org.eclipse.jetty.websocket.core.FrameHandler.CoreSession; import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient; import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator; import org.junit.jupiter.api.AfterEach; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorFrameFlagsTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorFrameFlagsTest.java index e21ce49fefe..941101cf3d9 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorFrameFlagsTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorFrameFlagsTest.java @@ -23,6 +23,7 @@ import java.util.LinkedList; import java.util.stream.Stream; import org.eclipse.jetty.util.BufferUtil; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; import org.eclipse.jetty.websocket.core.internal.ExtensionStack; import org.eclipse.jetty.websocket.core.internal.Generator; import org.eclipse.jetty.websocket.core.internal.Negotiated; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorTest.java index 28d8c8364dd..292f58f041c 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorTest.java @@ -30,6 +30,8 @@ import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; +import org.eclipse.jetty.websocket.core.exception.WebSocketException; import org.eclipse.jetty.websocket.core.internal.ExtensionStack; import org.eclipse.jetty.websocket.core.internal.Generator; import org.eclipse.jetty.websocket.core.internal.Negotiated; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java index e4e67f8e3ff..37f811939c6 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java @@ -29,7 +29,8 @@ import org.eclipse.jetty.io.MappedByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.FutureCallback; -import org.eclipse.jetty.websocket.core.FrameHandler.CoreSession; +import org.eclipse.jetty.websocket.core.exception.BadPayloadException; +import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/OpCodeTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/OpCodeTest.java index c68a4d1eaa2..c7680ffce37 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/OpCodeTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/OpCodeTest.java @@ -18,6 +18,7 @@ package org.eclipse.jetty.websocket.core; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; import org.eclipse.jetty.websocket.core.internal.FrameSequence; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserBadCloseStatusCodesTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserBadCloseStatusCodesTest.java index 3dc9212ffa6..e09c49d95d1 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserBadCloseStatusCodesTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserBadCloseStatusCodesTest.java @@ -25,6 +25,7 @@ import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.MappedByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.log.StacklessLogging; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; import org.eclipse.jetty.websocket.core.internal.Parser; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserBadOpCodesTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserBadOpCodesTest.java index 48286570d8e..900b51b33da 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserBadOpCodesTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserBadOpCodesTest.java @@ -25,6 +25,7 @@ import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.MappedByteBufferPool; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.log.StacklessLogging; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; import org.eclipse.jetty.websocket.core.internal.Parser; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserReservedBitTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserReservedBitTest.java index 6cd16a093a6..6613d18d316 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserReservedBitTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserReservedBitTest.java @@ -25,6 +25,7 @@ import java.util.List; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.log.StacklessLogging; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; import org.eclipse.jetty.websocket.core.internal.Generator; import org.eclipse.jetty.websocket.core.internal.Parser; import org.junit.jupiter.api.Test; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserTest.java index f7dee5b749b..4486e6901ad 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserTest.java @@ -29,6 +29,8 @@ import org.eclipse.jetty.toolchain.test.Hex; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.TypeUtil; +import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; import org.eclipse.jetty.websocket.core.internal.Generator; import org.eclipse.jetty.websocket.core.internal.Parser; import org.hamcrest.Matchers; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketNegotiator.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketNegotiator.java index 53430af39e5..6aa60d090b7 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketNegotiator.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketNegotiator.java @@ -53,7 +53,7 @@ public class TestWebSocketNegotiator implements WebSocketNegotiator } @Override - public void customize(FrameHandler.Configuration configurable) + public void customize(Configuration configurable) { } diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketNegotiationTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketNegotiationTest.java index 63dc1b99b79..67d41aedd2c 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketNegotiationTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketNegotiationTest.java @@ -37,10 +37,10 @@ import org.eclipse.jetty.server.HttpChannel; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.log.StacklessLogging; -import org.eclipse.jetty.websocket.core.FrameHandler.CoreSession; import org.eclipse.jetty.websocket.core.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.core.client.UpgradeListener; import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient; +import org.eclipse.jetty.websocket.core.exception.UpgradeException; import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession; import org.eclipse.jetty.websocket.core.server.Negotiation; import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketOpenTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketOpenTest.java index a55d389c2c9..d70097df1a1 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketOpenTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketOpenTest.java @@ -59,7 +59,7 @@ public class WebSocketOpenTest extends WebSocketTester server.stop(); } - public void setup(BiFunction onOpen) throws Exception + public void setup(BiFunction onOpen) throws Exception { serverHandler = new DemandingAsyncFrameHandler(onOpen); server = new WebSocketServer(serverHandler); @@ -136,7 +136,7 @@ public class WebSocketOpenTest extends WebSocketTester @Test public void testAsyncOnOpen() throws Exception { - Exchanger sx = new Exchanger<>(); + Exchanger sx = new Exchanger<>(); Exchanger cx = new Exchanger<>(); setup((s, c) -> { @@ -153,7 +153,7 @@ public class WebSocketOpenTest extends WebSocketTester return null; }); - FrameHandler.CoreSession coreSession = sx.exchange(null); + CoreSession coreSession = sx.exchange(null); Callback onOpenCallback = cx.exchange(null); Thread.sleep(100); diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnFrameHandler.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnFrameHandler.java index 3de7b168cd2..e79b726af5a 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnFrameHandler.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnFrameHandler.java @@ -22,6 +22,7 @@ import java.nio.ByteBuffer; import java.time.Duration; import org.eclipse.jetty.util.Callback; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.TestMessageHandler; public class AutobahnFrameHandler extends TestMessageHandler diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnClient.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnClient.java index 6503abf72ea..8c793b59e23 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnClient.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/CoreAutobahnClient.java @@ -29,7 +29,7 @@ import org.eclipse.jetty.util.Jetty; import org.eclipse.jetty.util.UrlEncoded; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.TestMessageHandler; import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient; @@ -154,7 +154,7 @@ public class CoreAutobahnClient { URI wsUri = baseWebsocketUri.resolve("/getCaseCount"); TestMessageHandler onCaseCount = new TestMessageHandler(); - Future response = client.connect(onCaseCount, wsUri); + Future response = client.connect(onCaseCount, wsUri); if (waitForUpgrade(wsUri, response)) { @@ -173,7 +173,7 @@ public class CoreAutobahnClient LOG.info("test uri: {}", wsUri); AutobahnFrameHandler echoHandler = new AutobahnFrameHandler(); - Future response = client.connect(echoHandler, wsUri); + Future response = client.connect(echoHandler, wsUri); if (waitForUpgrade(wsUri, response)) { // Wait up to 5 min as some of the tests can take a while @@ -201,14 +201,14 @@ public class CoreAutobahnClient { URI wsUri = baseWebsocketUri.resolve("/updateReports?agent=" + UrlEncoded.encodeString(userAgent)); TestMessageHandler onUpdateReports = new TestMessageHandler(); - Future response = client.connect(onUpdateReports, wsUri); + Future response = client.connect(onUpdateReports, wsUri); response.get(5, TimeUnit.SECONDS); assertTrue(onUpdateReports.closeLatch.await(15, TimeUnit.SECONDS)); LOG.info("Reports updated."); LOG.info("Test suite finished!"); } - private boolean waitForUpgrade(URI wsUri, Future response) throws InterruptedException + private boolean waitForUpgrade(URI wsUri, Future response) throws InterruptedException { try { diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketServer.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketServer.java index c12c300b788..f2b861dbe9b 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketServer.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/chat/ChatWebSocketServer.java @@ -34,6 +34,7 @@ import org.eclipse.jetty.server.handler.AbstractHandler; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.websocket.core.CloseStatus; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.MessageHandler; import org.eclipse.jetty.websocket.core.server.Negotiation; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/client/WebSocketClientServerTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/client/WebSocketClientServerTest.java index 36d460f3d06..b8d35bd8fe4 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/client/WebSocketClientServerTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/client/WebSocketClientServerTest.java @@ -27,7 +27,7 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler.CoreSession; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.TestFrameHandler; import org.eclipse.jetty.websocket.core.WebSocketServer; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflateExtensionTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflateExtensionTest.java index 01f8ca30b5e..a1097aefc46 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflateExtensionTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflateExtensionTest.java @@ -33,11 +33,11 @@ import org.eclipse.jetty.util.TypeUtil; import org.eclipse.jetty.websocket.core.Behavior; import org.eclipse.jetty.websocket.core.ExtensionConfig; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler.ConfigurationCustomizer; +import org.eclipse.jetty.websocket.core.Configuration.ConfigurationCustomizer; import org.eclipse.jetty.websocket.core.IncomingFramesCapture; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.OutgoingFramesCapture; -import org.eclipse.jetty.websocket.core.ProtocolException; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; import org.eclipse.jetty.websocket.core.TestMessageHandler; import org.eclipse.jetty.websocket.core.internal.ExtensionStack; import org.eclipse.jetty.websocket.core.internal.Negotiated; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflaterBufferSizeTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflaterBufferSizeTest.java index 498ed794f13..f4dac1f1d97 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflaterBufferSizeTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflaterBufferSizeTest.java @@ -28,6 +28,7 @@ import org.eclipse.jetty.client.HttpRequest; import org.eclipse.jetty.client.HttpResponse; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.ExtensionConfig; import org.eclipse.jetty.websocket.core.Frame; import org.eclipse.jetty.websocket.core.FrameHandler; @@ -115,7 +116,7 @@ public class PerMessageDeflaterBufferSizeTest }); // Connect to the server. - CompletableFuture connect = client.connect(upgradeRequest); + CompletableFuture connect = client.connect(upgradeRequest); connect.get(5, TimeUnit.SECONDS); // Make sure the internal parameter was not sent to the server. @@ -168,7 +169,7 @@ public class PerMessageDeflaterBufferSizeTest }); // Connect to the server. - CompletableFuture connect = client.connect(upgradeRequest); + CompletableFuture connect = client.connect(upgradeRequest); connect.get(5, TimeUnit.SECONDS); // Make sure the internal parameter was not sent to the server. @@ -222,7 +223,7 @@ public class PerMessageDeflaterBufferSizeTest }); // Connect to the server. - CompletableFuture connect = client.connect(upgradeRequest); + CompletableFuture connect = client.connect(upgradeRequest); connect.get(5, TimeUnit.SECONDS); // Make sure the internal parameter was not sent from the server. @@ -276,7 +277,7 @@ public class PerMessageDeflaterBufferSizeTest }); // Connect to the server. - CompletableFuture connect = client.connect(upgradeRequest); + CompletableFuture connect = client.connect(upgradeRequest); connect.get(5, TimeUnit.SECONDS); // Make sure the internal parameter was not sent from the server. diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/internal/FrameFlusherTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/internal/FrameFlusherTest.java index 25fb27171b1..6fa6295e7b9 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/internal/FrameFlusherTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/internal/FrameFlusherTest.java @@ -43,7 +43,7 @@ import org.eclipse.jetty.websocket.core.CloseStatus; import org.eclipse.jetty.websocket.core.Frame; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.WebSocketConstants; -import org.eclipse.jetty.websocket.core.WebSocketWriteTimeoutException; +import org.eclipse.jetty.websocket.core.exception.WebSocketWriteTimeoutException; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxy.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxy.java index 24dd71c2f30..5f5151e4bd6 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxy.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxy.java @@ -29,6 +29,7 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.core.CloseStatus; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxyTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxyTest.java index b7e3d984dc7..cad6048e962 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxyTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxyTest.java @@ -39,10 +39,10 @@ import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.StacklessLogging; import org.eclipse.jetty.websocket.core.CloseStatus; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.EchoFrameHandler; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; -import org.eclipse.jetty.websocket.core.FrameHandler.CoreSession; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.TestAsyncFrameHandler; import org.eclipse.jetty.websocket.core.client.ClientUpgradeRequest; @@ -72,7 +72,7 @@ public class WebSocketProxyTest private WebSocketProxy proxy; private EchoFrameHandler serverFrameHandler; private TestHandler testHandler; - FrameHandler.ConfigurationCustomizer defaultCustomizer; + Configuration.ConfigurationCustomizer defaultCustomizer; private class TestHandler extends AbstractHandler { @@ -109,7 +109,7 @@ public class WebSocketProxyTest testHandler = new TestHandler(); handlers.addHandler(testHandler); - defaultCustomizer = new FrameHandler.ConfigurationCustomizer(); + defaultCustomizer = new Configuration.ConfigurationCustomizer(); defaultCustomizer.setIdleTimeout(Duration.ofSeconds(3)); ContextHandler serverContext = new ContextHandler("/server"); diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/server/WebSocketServerTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/server/WebSocketServerTest.java index 60ddf4b3a7d..c1aeb0d8c0f 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/server/WebSocketServerTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/server/WebSocketServerTest.java @@ -30,6 +30,7 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.core.CloseStatus; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.RawFrameBuilder; diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/InvalidWebSocketException.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/InvalidWebSocketException.java index 04f9457da4e..7abbc21fdbb 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/InvalidWebSocketException.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/InvalidWebSocketException.java @@ -18,7 +18,7 @@ package org.eclipse.jetty.websocket.javax.common; -import org.eclipse.jetty.websocket.core.WebSocketException; +import org.eclipse.jetty.websocket.core.exception.WebSocketException; /** * Indicating that the provided Class is not a valid WebSocket per the chosen API. diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketAsyncRemote.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketAsyncRemote.java index 5a969df1b52..c8a9fdd8dd0 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketAsyncRemote.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketAsyncRemote.java @@ -30,8 +30,8 @@ import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.FutureCallback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.javax.common.messages.MessageOutputStream; import org.eclipse.jetty.websocket.javax.common.messages.MessageWriter; @@ -41,7 +41,7 @@ public class JavaxWebSocketAsyncRemote extends JavaxWebSocketRemoteEndpoint impl { static final Logger LOG = Log.getLogger(JavaxWebSocketAsyncRemote.class); - protected JavaxWebSocketAsyncRemote(JavaxWebSocketSession session, FrameHandler.CoreSession coreSession) + protected JavaxWebSocketAsyncRemote(JavaxWebSocketSession session, CoreSession coreSession) { super(session, coreSession); } diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketBasicRemote.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketBasicRemote.java index facff847978..80a0c86fac7 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketBasicRemote.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketBasicRemote.java @@ -29,8 +29,8 @@ import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.SharedBlockingCallback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.javax.common.util.TextUtil; @@ -40,7 +40,7 @@ public class JavaxWebSocketBasicRemote extends JavaxWebSocketRemoteEndpoint impl { private static final Logger LOG = Log.getLogger(JavaxWebSocketBasicRemote.class); - protected JavaxWebSocketBasicRemote(JavaxWebSocketSession session, FrameHandler.CoreSession coreSession) + protected JavaxWebSocketBasicRemote(JavaxWebSocketSession session, CoreSession coreSession) { super(session, coreSession); } diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketContainer.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketContainer.java index 6822525f0b5..5ce80190aba 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketContainer.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketContainer.java @@ -33,7 +33,7 @@ import org.eclipse.jetty.util.DecoratedObjectFactory; import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.WebSocketComponents; import org.eclipse.jetty.websocket.core.WebSocketExtensionRegistry; @@ -42,7 +42,7 @@ public abstract class JavaxWebSocketContainer extends ContainerLifeCycle impleme private static final Logger LOG = Log.getLogger(JavaxWebSocketContainer.class); private final SessionTracker sessionTracker = new SessionTracker(); private List sessionListeners = new ArrayList<>(); - protected FrameHandler.ConfigurationCustomizer defaultCustomizer = new FrameHandler.ConfigurationCustomizer(); + protected Configuration.ConfigurationCustomizer defaultCustomizer = new Configuration.ConfigurationCustomizer(); protected WebSocketComponents components; public JavaxWebSocketContainer(WebSocketComponents components) diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler.java index 378ef535da6..7bd8b007082 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler.java @@ -41,11 +41,12 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.core.CloseStatus; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; -import org.eclipse.jetty.websocket.core.ProtocolException; -import org.eclipse.jetty.websocket.core.WebSocketException; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; +import org.eclipse.jetty.websocket.core.exception.WebSocketException; import org.eclipse.jetty.websocket.javax.common.decoders.AvailableDecoders; import org.eclipse.jetty.websocket.javax.common.messages.DecodedBinaryMessageSink; import org.eclipse.jetty.websocket.javax.common.messages.DecodedBinaryStreamMessageSink; diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketRemoteEndpoint.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketRemoteEndpoint.java index d02b27459fa..df80fbdf880 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketRemoteEndpoint.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketRemoteEndpoint.java @@ -30,11 +30,11 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.SharedBlockingCallback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.OutgoingFrames; -import org.eclipse.jetty.websocket.core.WebSocketException; +import org.eclipse.jetty.websocket.core.exception.WebSocketException; import org.eclipse.jetty.websocket.javax.common.messages.MessageOutputStream; import org.eclipse.jetty.websocket.javax.common.messages.MessageWriter; @@ -43,11 +43,11 @@ public class JavaxWebSocketRemoteEndpoint implements javax.websocket.RemoteEndpo private static final Logger LOG = Log.getLogger(JavaxWebSocketRemoteEndpoint.class); protected final JavaxWebSocketSession session; - private final FrameHandler.CoreSession coreSession; + private final CoreSession coreSession; protected boolean batch = false; protected byte messageType = -1; - protected JavaxWebSocketRemoteEndpoint(JavaxWebSocketSession session, FrameHandler.CoreSession coreSession) + protected JavaxWebSocketRemoteEndpoint(JavaxWebSocketSession session, CoreSession coreSession) { this.session = session; this.coreSession = coreSession; diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketSession.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketSession.java index 0ba2dee7304..938aece5753 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketSession.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketSession.java @@ -41,8 +41,8 @@ import javax.websocket.WebSocketContainer; import org.eclipse.jetty.util.SharedBlockingCallback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.ExtensionConfig; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.javax.common.decoders.AvailableDecoders; import org.eclipse.jetty.websocket.javax.common.encoders.AvailableEncoders; import org.eclipse.jetty.websocket.javax.common.util.ReflectUtils; @@ -56,7 +56,7 @@ public class JavaxWebSocketSession implements javax.websocket.Session protected final SharedBlockingCallback blocking = new SharedBlockingCallback(); private final JavaxWebSocketContainer container; - private final FrameHandler.CoreSession coreSession; + private final CoreSession coreSession; private final JavaxWebSocketFrameHandler frameHandler; private final EndpointConfig config; private final AvailableDecoders availableDecoders; @@ -69,7 +69,7 @@ public class JavaxWebSocketSession implements javax.websocket.Session private JavaxWebSocketBasicRemote basicRemote; public JavaxWebSocketSession(JavaxWebSocketContainer container, - FrameHandler.CoreSession coreSession, + CoreSession coreSession, JavaxWebSocketFrameHandler frameHandler, EndpointConfig endpointConfig) { @@ -94,7 +94,7 @@ public class JavaxWebSocketSession implements javax.websocket.Session this.userProperties = this.config.getUserProperties(); } - public FrameHandler.CoreSession getCoreSession() + public CoreSession getCoreSession() { return coreSession; } diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/ByteArrayMessageSink.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/ByteArrayMessageSink.java index 2d9100ab3af..0e9f6792499 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/ByteArrayMessageSink.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/ByteArrayMessageSink.java @@ -27,7 +27,7 @@ import java.util.Objects; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.MessageTooLargeException; +import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException; import org.eclipse.jetty.websocket.javax.common.JavaxWebSocketSession; import org.eclipse.jetty.websocket.javax.common.util.InvalidSignatureException; diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/ByteBufferMessageSink.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/ByteBufferMessageSink.java index ed939a05540..532ad76b2f7 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/ByteBufferMessageSink.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/ByteBufferMessageSink.java @@ -25,7 +25,7 @@ import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.MessageTooLargeException; +import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException; import org.eclipse.jetty.websocket.javax.common.JavaxWebSocketSession; public class ByteBufferMessageSink extends AbstractMessageSink diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedBinaryMessageSink.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedBinaryMessageSink.java index de56031549a..be4744adfe3 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedBinaryMessageSink.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedBinaryMessageSink.java @@ -26,7 +26,7 @@ import javax.websocket.CloseReason; import javax.websocket.DecodeException; import javax.websocket.Decoder; -import org.eclipse.jetty.websocket.core.CloseException; +import org.eclipse.jetty.websocket.core.exception.CloseException; import org.eclipse.jetty.websocket.javax.common.JavaxWebSocketSession; import org.eclipse.jetty.websocket.javax.common.MessageSink; diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedBinaryStreamMessageSink.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedBinaryStreamMessageSink.java index 4b8d8382639..916b67711de 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedBinaryStreamMessageSink.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedBinaryStreamMessageSink.java @@ -26,7 +26,7 @@ import javax.websocket.CloseReason; import javax.websocket.DecodeException; import javax.websocket.Decoder; -import org.eclipse.jetty.websocket.core.CloseException; +import org.eclipse.jetty.websocket.core.exception.CloseException; import org.eclipse.jetty.websocket.javax.common.JavaxWebSocketSession; import org.eclipse.jetty.websocket.javax.common.MessageSink; diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedTextMessageSink.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedTextMessageSink.java index 07c6c6f99a3..d5db51ec574 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedTextMessageSink.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedTextMessageSink.java @@ -25,7 +25,7 @@ import javax.websocket.CloseReason; import javax.websocket.DecodeException; import javax.websocket.Decoder; -import org.eclipse.jetty.websocket.core.CloseException; +import org.eclipse.jetty.websocket.core.exception.CloseException; import org.eclipse.jetty.websocket.javax.common.JavaxWebSocketSession; import org.eclipse.jetty.websocket.javax.common.MessageSink; diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedTextStreamMessageSink.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedTextStreamMessageSink.java index 7051f38a7d2..439efd0207b 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedTextStreamMessageSink.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/DecodedTextStreamMessageSink.java @@ -26,7 +26,7 @@ import javax.websocket.CloseReason; import javax.websocket.DecodeException; import javax.websocket.Decoder; -import org.eclipse.jetty.websocket.core.CloseException; +import org.eclipse.jetty.websocket.core.exception.CloseException; import org.eclipse.jetty.websocket.javax.common.JavaxWebSocketSession; import org.eclipse.jetty.websocket.javax.common.MessageSink; diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/MessageOutputStream.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/MessageOutputStream.java index 0e868f158ed..8bf5030bbc6 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/MessageOutputStream.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/MessageOutputStream.java @@ -28,8 +28,8 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.SharedBlockingCallback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; /** @@ -39,7 +39,7 @@ public class MessageOutputStream extends OutputStream { private static final Logger LOG = Log.getLogger(MessageOutputStream.class); - private final FrameHandler.CoreSession coreSession; + private final CoreSession coreSession; private final ByteBufferPool bufferPool; private final SharedBlockingCallback blocker; private long frameCount; @@ -49,7 +49,7 @@ public class MessageOutputStream extends OutputStream private Callback callback; private boolean closed; - public MessageOutputStream(FrameHandler.CoreSession coreSession, int bufferSize, ByteBufferPool bufferPool) + public MessageOutputStream(CoreSession coreSession, int bufferSize, ByteBufferPool bufferPool) { this.coreSession = coreSession; this.bufferPool = bufferPool; diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/MessageWriter.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/MessageWriter.java index 33916a756c7..a9ba0f6f061 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/MessageWriter.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/MessageWriter.java @@ -30,8 +30,8 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.SharedBlockingCallback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import static java.nio.charset.StandardCharsets.UTF_8; @@ -49,7 +49,7 @@ public class MessageWriter extends Writer .onUnmappableCharacter(CodingErrorAction.REPORT) .onMalformedInput(CodingErrorAction.REPORT); - private final FrameHandler.CoreSession coreSession; + private final CoreSession coreSession; private final SharedBlockingCallback blocker; private long frameCount; private Frame frame; @@ -57,7 +57,7 @@ public class MessageWriter extends Writer private Callback callback; private boolean closed; - public MessageWriter(FrameHandler.CoreSession coreSession, int bufferSize) + public MessageWriter(CoreSession coreSession, int bufferSize) { this.coreSession = coreSession; this.blocker = new SharedBlockingCallback(); diff --git a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/StringMessageSink.java b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/StringMessageSink.java index 291c6a5c67d..7bbf4ad0d91 100644 --- a/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/StringMessageSink.java +++ b/jetty-websocket/websocket-javax-common/src/main/java/org/eclipse/jetty/websocket/javax/common/messages/StringMessageSink.java @@ -27,7 +27,7 @@ import org.eclipse.jetty.util.Utf8StringBuilder; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.MessageTooLargeException; +import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException; import org.eclipse.jetty.websocket.javax.common.JavaxWebSocketSession; public class StringMessageSink extends AbstractMessageSink diff --git a/jetty-websocket/websocket-javax-common/src/test/java/org/eclipse/jetty/websocket/javax/common/AbstractJavaxWebSocketFrameHandlerTest.java b/jetty-websocket/websocket-javax-common/src/test/java/org/eclipse/jetty/websocket/javax/common/AbstractJavaxWebSocketFrameHandlerTest.java index 412919c77d7..65395d89792 100644 --- a/jetty-websocket/websocket-javax-common/src/test/java/org/eclipse/jetty/websocket/javax/common/AbstractJavaxWebSocketFrameHandlerTest.java +++ b/jetty-websocket/websocket-javax-common/src/test/java/org/eclipse/jetty/websocket/javax/common/AbstractJavaxWebSocketFrameHandlerTest.java @@ -23,7 +23,7 @@ import java.util.Map; import javax.websocket.ClientEndpointConfig; import javax.websocket.EndpointConfig; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.javax.common.decoders.AvailableDecoders; import org.eclipse.jetty.websocket.javax.common.encoders.AvailableEncoders; import org.junit.jupiter.api.AfterAll; @@ -50,7 +50,7 @@ public abstract class AbstractJavaxWebSocketFrameHandlerTest protected AvailableDecoders decoders; protected Map uriParams; protected EndpointConfig endpointConfig; - protected FrameHandler.CoreSession coreSession = new FrameHandler.CoreSession.Empty(); + protected CoreSession coreSession = new CoreSession.Empty(); public AbstractJavaxWebSocketFrameHandlerTest() { diff --git a/jetty-websocket/websocket-javax-common/src/test/java/org/eclipse/jetty/websocket/javax/common/AbstractSessionTest.java b/jetty-websocket/websocket-javax-common/src/test/java/org/eclipse/jetty/websocket/javax/common/AbstractSessionTest.java index 9411bb26ab2..fc103c40646 100644 --- a/jetty-websocket/websocket-javax-common/src/test/java/org/eclipse/jetty/websocket/javax/common/AbstractSessionTest.java +++ b/jetty-websocket/websocket-javax-common/src/test/java/org/eclipse/jetty/websocket/javax/common/AbstractSessionTest.java @@ -22,7 +22,7 @@ import javax.websocket.Endpoint; import javax.websocket.EndpointConfig; import javax.websocket.Session; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.CoreSession; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -39,7 +39,7 @@ public abstract class AbstractSessionTest Object websocketPojo = new DummyEndpoint(); UpgradeRequest upgradeRequest = new UpgradeRequestAdapter(); JavaxWebSocketFrameHandler frameHandler = container.newFrameHandler(websocketPojo, upgradeRequest); - FrameHandler.CoreSession coreSession = new FrameHandler.CoreSession.Empty(); + CoreSession coreSession = new CoreSession.Empty(); session = new JavaxWebSocketSession(container, coreSession, frameHandler, container.getFrameHandlerFactory() .newDefaultEndpointConfig(websocketPojo.getClass(), null)); } diff --git a/jetty-websocket/websocket-javax-common/src/test/java/org/eclipse/jetty/websocket/javax/common/messages/MessageWriterTest.java b/jetty-websocket/websocket-javax-common/src/test/java/org/eclipse/jetty/websocket/javax/common/messages/MessageWriterTest.java index 24efba23ce2..fa4660c2084 100644 --- a/jetty-websocket/websocket-javax-common/src/test/java/org/eclipse/jetty/websocket/javax/common/messages/MessageWriterTest.java +++ b/jetty-websocket/websocket-javax-common/src/test/java/org/eclipse/jetty/websocket/javax/common/messages/MessageWriterTest.java @@ -26,8 +26,8 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.Utf8StringBuilder; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import org.junit.jupiter.api.Test; @@ -139,7 +139,7 @@ public class MessageWriterTest assertThat("Message[0].length", message.length(), is(testSize)); } - public static class FrameCapture extends FrameHandler.CoreSession.Empty + public static class FrameCapture extends CoreSession.Empty { public BlockingQueue frames = new LinkedBlockingQueue<>(); @@ -151,7 +151,7 @@ public class MessageWriterTest } } - public static class WholeMessageCapture extends FrameHandler.CoreSession.Empty + public static class WholeMessageCapture extends CoreSession.Empty { public BlockingQueue messages = new LinkedBlockingQueue<>(); diff --git a/jetty-websocket/websocket-javax-server/src/main/java/org/eclipse/jetty/websocket/javax/server/internal/JavaxWebSocketServerContainer.java b/jetty-websocket/websocket-javax-server/src/main/java/org/eclipse/jetty/websocket/javax/server/internal/JavaxWebSocketServerContainer.java index a20eadd32a3..bfad5ae60aa 100644 --- a/jetty-websocket/websocket-javax-server/src/main/java/org/eclipse/jetty/websocket/javax/server/internal/JavaxWebSocketServerContainer.java +++ b/jetty-websocket/websocket-javax-server/src/main/java/org/eclipse/jetty/websocket/javax/server/internal/JavaxWebSocketServerContainer.java @@ -37,7 +37,7 @@ import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.core.WebSocketComponents; -import org.eclipse.jetty.websocket.core.WebSocketException; +import org.eclipse.jetty.websocket.core.exception.WebSocketException; import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient; import org.eclipse.jetty.websocket.javax.client.JavaxWebSocketClientContainer; import org.eclipse.jetty.websocket.javax.server.config.JavaxWebSocketServletContainerInitializer; diff --git a/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/CoreServer.java b/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/CoreServer.java index 274fc1d8c26..dea69e7c877 100644 --- a/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/CoreServer.java +++ b/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/CoreServer.java @@ -31,6 +31,7 @@ import org.eclipse.jetty.server.handler.HandlerList; import org.eclipse.jetty.util.DecoratedObjectFactory; import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.thread.QueuedThreadPool; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.WebSocketComponents; import org.eclipse.jetty.websocket.core.WebSocketExtensionRegistry; @@ -116,7 +117,7 @@ public class CoreServer extends ContainerLifeCycle } @Override - public void customize(FrameHandler.Configuration configurable) + public void customize(Configuration configurable) { } @@ -178,7 +179,7 @@ public class CoreServer extends ContainerLifeCycle } @Override - public void customize(FrameHandler.Configuration configurable) + public void customize(Configuration configurable) { } } diff --git a/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/NetworkFuzzer.java b/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/NetworkFuzzer.java index 4a9b7a14db1..ac46308ed2d 100644 --- a/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/NetworkFuzzer.java +++ b/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/NetworkFuzzer.java @@ -36,6 +36,7 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.SharedBlockingCallback; import org.eclipse.jetty.websocket.core.Behavior; import org.eclipse.jetty.websocket.core.CloseStatus; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.client.ClientUpgradeRequest; @@ -81,7 +82,7 @@ public class NetworkFuzzer extends Fuzzer.Adapter implements Fuzzer, AutoCloseab this.client.start(); this.generator = new UnitGenerator(Behavior.CLIENT); - CompletableFuture futureHandler = this.client.connect(upgradeRequest); + CompletableFuture futureHandler = this.client.connect(upgradeRequest); CompletableFuture futureCapture = futureHandler.thenCombine(upgradeRequest.getFuture(), (session, capture) -> capture); this.frameCapture = futureCapture.get(10, TimeUnit.SECONDS); } diff --git a/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/framehandlers/FrameEcho.java b/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/framehandlers/FrameEcho.java index 6d7cbe87a3d..5a2fd118f8f 100644 --- a/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/framehandlers/FrameEcho.java +++ b/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/framehandlers/FrameEcho.java @@ -22,6 +22,7 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.core.CloseStatus; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; import org.eclipse.jetty.websocket.core.FrameHandler; diff --git a/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/framehandlers/FrameHandlerTracker.java b/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/framehandlers/FrameHandlerTracker.java index b4ff93b0a6b..2a296734d50 100644 --- a/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/framehandlers/FrameHandlerTracker.java +++ b/jetty-websocket/websocket-javax-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/framehandlers/FrameHandlerTracker.java @@ -27,6 +27,7 @@ import java.util.concurrent.atomic.AtomicReference; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.websocket.core.CloseStatus; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.MessageHandler; public class FrameHandlerTracker extends MessageHandler diff --git a/jetty-websocket/websocket-javax-tests/src/test/java/com/acme/websocket/IdleTimeoutOnOpenSocket.java b/jetty-websocket/websocket-javax-tests/src/test/java/com/acme/websocket/IdleTimeoutOnOpenSocket.java index 3278e6594db..56ff4fc200f 100644 --- a/jetty-websocket/websocket-javax-tests/src/test/java/com/acme/websocket/IdleTimeoutOnOpenSocket.java +++ b/jetty-websocket/websocket-javax-tests/src/test/java/com/acme/websocket/IdleTimeoutOnOpenSocket.java @@ -24,7 +24,7 @@ import javax.websocket.OnOpen; import javax.websocket.Session; import javax.websocket.server.ServerEndpoint; -import org.eclipse.jetty.websocket.core.WebSocketTimeoutException; +import org.eclipse.jetty.websocket.core.exception.WebSocketTimeoutException; @ServerEndpoint(value = "/idle-onopen-socket") public class IdleTimeoutOnOpenSocket diff --git a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/AbstractClientSessionTest.java b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/AbstractClientSessionTest.java index bb59615edc5..76499f264de 100644 --- a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/AbstractClientSessionTest.java +++ b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/AbstractClientSessionTest.java @@ -18,7 +18,7 @@ package org.eclipse.jetty.websocket.javax.tests.client; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.javax.client.BasicClientEndpointConfig; import org.eclipse.jetty.websocket.javax.client.JavaxWebSocketClientContainer; import org.eclipse.jetty.websocket.javax.common.JavaxWebSocketContainer; @@ -43,7 +43,7 @@ public abstract class AbstractClientSessionTest Object websocketPojo = new DummyEndpoint(); UpgradeRequest upgradeRequest = new UpgradeRequestAdapter(); JavaxWebSocketFrameHandler frameHandler = container.newFrameHandler(websocketPojo, upgradeRequest); - FrameHandler.CoreSession coreSession = new FrameHandler.CoreSession.Empty(); + CoreSession coreSession = new CoreSession.Empty(); session = new JavaxWebSocketSession(container, coreSession, frameHandler, new BasicClientEndpointConfig()); } diff --git a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/MessageReceivingTest.java b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/MessageReceivingTest.java index 8dd935eaba9..b5331a36ebc 100644 --- a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/MessageReceivingTest.java +++ b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/MessageReceivingTest.java @@ -41,6 +41,7 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.Frame; import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.MessageHandler; @@ -379,7 +380,7 @@ public class MessageReceivingTest } @Override - public void customize(FrameHandler.Configuration configurable) + public void customize(Configuration configurable) { configurable.setMaxBinaryMessageSize(MAX_MESSAGE_SIZE); configurable.setMaxTextMessageSize(MAX_MESSAGE_SIZE); diff --git a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/OnCloseTest.java b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/OnCloseTest.java index 2b6649f413f..ec2669828c4 100644 --- a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/OnCloseTest.java +++ b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/OnCloseTest.java @@ -26,7 +26,7 @@ import javax.websocket.ClientEndpointConfig; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.websocket.core.CloseStatus; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.javax.client.BasicClientEndpointConfig; import org.eclipse.jetty.websocket.javax.client.JavaxWebSocketClientContainer; import org.eclipse.jetty.websocket.javax.common.JavaxWebSocketFrameHandler; @@ -104,7 +104,7 @@ public class OnCloseTest UpgradeRequest request = new UpgradeRequestAdapter(); JavaxWebSocketFrameHandler frameHandler = container.newFrameHandler(endpoint, request); - frameHandler.onOpen(new FrameHandler.CoreSession.Empty(), Callback.NOOP); + frameHandler.onOpen(new CoreSession.Empty(), Callback.NOOP); // Execute onClose call frameHandler.onFrame(CloseStatus.toFrame(CloseStatus.NORMAL), Callback.NOOP); diff --git a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/SessionAddMessageHandlerTest.java b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/SessionAddMessageHandlerTest.java index 94c6eeb68f9..d074a7dd965 100644 --- a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/SessionAddMessageHandlerTest.java +++ b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/SessionAddMessageHandlerTest.java @@ -27,8 +27,8 @@ import javax.websocket.MessageHandler; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.javax.client.BasicClientEndpointConfig; import org.eclipse.jetty.websocket.javax.client.JavaxWebSocketClientContainer; @@ -78,7 +78,7 @@ public class SessionAddMessageHandlerTest JavaxWebSocketFrameHandlerFactory frameHandlerFactory = new JavaxWebSocketClientFrameHandlerFactory(container); frameHandler = frameHandlerFactory.newJavaxWebSocketFrameHandler(ei, handshakeRequest); - frameHandler.onOpen(new FrameHandler.CoreSession.Empty(), Callback.NOOP); + frameHandler.onOpen(new CoreSession.Empty(), Callback.NOOP); // Session session = frameHandler.getSession(); diff --git a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/WriteTimeoutTest.java b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/WriteTimeoutTest.java index 160791b315c..8c22d63b328 100644 --- a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/WriteTimeoutTest.java +++ b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/WriteTimeoutTest.java @@ -30,7 +30,7 @@ import javax.websocket.server.ServerEndpoint; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.WebSocketWriteTimeoutException; +import org.eclipse.jetty.websocket.core.exception.WebSocketWriteTimeoutException; import org.eclipse.jetty.websocket.javax.tests.LocalServer; import org.eclipse.jetty.websocket.javax.tests.WSEndpointTracker; import org.hamcrest.Matchers; diff --git a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/ConfiguratorTest.java b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/ConfiguratorTest.java index ac72ce9732e..095eaabdac7 100644 --- a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/ConfiguratorTest.java +++ b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/ConfiguratorTest.java @@ -53,8 +53,8 @@ import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.client.ClientUpgradeRequest; import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient; @@ -432,9 +432,9 @@ public class ConfiguratorTest FrameHandlerTracker clientSocket = new FrameHandlerTracker(); ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(client, wsUri, clientSocket); upgradeRequest.addExtensions("identity"); - Future clientConnectFuture = client.connect(upgradeRequest); + Future clientConnectFuture = client.connect(upgradeRequest); - FrameHandler.CoreSession coreSession = clientConnectFuture.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); + CoreSession coreSession = clientConnectFuture.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); try { coreSession.sendFrame(new Frame(OpCode.TEXT).setPayload(HttpHeader.SEC_WEBSOCKET_EXTENSIONS.asString()), Callback.NOOP, false); @@ -456,9 +456,9 @@ public class ConfiguratorTest FrameHandlerTracker clientSocket = new FrameHandlerTracker(); ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(client, wsUri, clientSocket); upgradeRequest.addExtensions("identity"); - Future clientConnectFuture = client.connect(upgradeRequest); + Future clientConnectFuture = client.connect(upgradeRequest); - FrameHandler.CoreSession coreSession = clientConnectFuture.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); + CoreSession coreSession = clientConnectFuture.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); try { coreSession.sendFrame(new Frame(OpCode.TEXT).setPayload("NegoExts"), Callback.NOOP, false); @@ -480,9 +480,9 @@ public class ConfiguratorTest FrameHandlerTracker clientSocket = new FrameHandlerTracker(); ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(client, wsUri, clientSocket); upgradeRequest.header("X-Dummy", "Bogus"); - Future clientConnectFuture = client.connect(upgradeRequest); + Future clientConnectFuture = client.connect(upgradeRequest); - FrameHandler.CoreSession coreSession = clientConnectFuture.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); + CoreSession coreSession = clientConnectFuture.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); try { coreSession.sendFrame(new Frame(OpCode.TEXT).setPayload("X-Dummy"), Callback.NOOP, false); @@ -504,9 +504,9 @@ public class ConfiguratorTest // First Request FrameHandlerTracker clientSocket = new FrameHandlerTracker(); ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(client, wsUri, clientSocket); - Future clientConnectFuture = client.connect(upgradeRequest); + Future clientConnectFuture = client.connect(upgradeRequest); - FrameHandler.CoreSession coreSession = clientConnectFuture.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); + CoreSession coreSession = clientConnectFuture.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); try { // first request has this UserProperty @@ -551,9 +551,9 @@ public class ConfiguratorTest FrameHandlerTracker clientSocket = new FrameHandlerTracker(); ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(client, wsUri, clientSocket); - Future clientConnectFuture = client.connect(upgradeRequest); + Future clientConnectFuture = client.connect(upgradeRequest); - FrameHandler.CoreSession coreSession = clientConnectFuture.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); + CoreSession coreSession = clientConnectFuture.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); try { SocketAddress expectedLocal = coreSession.getLocalAddress(); @@ -593,7 +593,7 @@ public class ConfiguratorTest FrameHandlerTracker clientSocket = new FrameHandlerTracker(); ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(client, wsUri, clientSocket); upgradeRequest.setSubProtocols("status"); - Future clientConnectFuture = client.connect(upgradeRequest); + Future clientConnectFuture = client.connect(upgradeRequest); assertProtocols(clientSocket, clientConnectFuture, is("Requested Protocols: [status]")); } @@ -612,7 +612,7 @@ public class ConfiguratorTest FrameHandlerTracker clientSocket = new FrameHandlerTracker(); ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(client, wsUri, clientSocket); upgradeRequest.setSubProtocols("echo", "chat", "status"); - Future clientConnectFuture = client.connect(upgradeRequest); + Future clientConnectFuture = client.connect(upgradeRequest); assertProtocols(clientSocket, clientConnectFuture, is("Requested Protocols: [echo,chat,status]")); } @@ -631,7 +631,7 @@ public class ConfiguratorTest FrameHandlerTracker clientSocket = new FrameHandlerTracker(); ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(client, wsUri, clientSocket); upgradeRequest.setSubProtocols("echo", "chat", "status"); - Future clientConnectFuture = client.connect(upgradeRequest); + Future clientConnectFuture = client.connect(upgradeRequest); assertProtocols(clientSocket, clientConnectFuture, is("Requested Protocols: [echo,chat,status]")); } @@ -650,15 +650,15 @@ public class ConfiguratorTest FrameHandlerTracker clientSocket = new FrameHandlerTracker(); ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(client, wsUri, clientSocket); upgradeRequest.setSubProtocols("echo", "chat", "status"); - Future clientConnectFuture = client.connect(upgradeRequest); + Future clientConnectFuture = client.connect(upgradeRequest); assertProtocols(clientSocket, clientConnectFuture, is("Requested Protocols: [echo,chat,status]")); } - protected void assertProtocols(FrameHandlerTracker clientSocket, Future clientConnectFuture, Matcher responseMatcher) + protected void assertProtocols(FrameHandlerTracker clientSocket, Future clientConnectFuture, Matcher responseMatcher) throws InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException { - FrameHandler.CoreSession coreSession = clientConnectFuture.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); + CoreSession coreSession = clientConnectFuture.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); try { coreSession.sendFrame(new Frame(OpCode.TEXT).setPayload("getProtocols"), Callback.NOOP, false); @@ -683,9 +683,9 @@ public class ConfiguratorTest FrameHandlerTracker clientSocket = new FrameHandlerTracker(); ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(client, wsUri, clientSocket); upgradeRequest.setSubProtocols("gmt"); - Future clientConnectFuture = client.connect(upgradeRequest); + Future clientConnectFuture = client.connect(upgradeRequest); - FrameHandler.CoreSession coreSession = clientConnectFuture.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); + CoreSession coreSession = clientConnectFuture.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); try { coreSession.sendFrame(new Frame(OpCode.TEXT).setPayload("2016-06-20T14:27:44"), Callback.NOOP, false); diff --git a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/EndpointViaConfigTest.java b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/EndpointViaConfigTest.java index 43f0e5dbe8c..0e1bdffba2c 100644 --- a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/EndpointViaConfigTest.java +++ b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/EndpointViaConfigTest.java @@ -30,8 +30,8 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.webapp.WebAppContext; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient; import org.eclipse.jetty.websocket.javax.tests.WSServer; @@ -76,9 +76,9 @@ public class EndpointViaConfigTest { client.start(); FrameHandlerTracker clientSocket = new FrameHandlerTracker(); - Future clientConnectFuture = client.connect(clientSocket, uri.resolve("/app/echo")); + Future clientConnectFuture = client.connect(clientSocket, uri.resolve("/app/echo")); // wait for connect - FrameHandler.CoreSession coreSession = clientConnectFuture.get(5, TimeUnit.SECONDS); + CoreSession coreSession = clientConnectFuture.get(5, TimeUnit.SECONDS); try { coreSession.sendFrame(new Frame(OpCode.TEXT).setPayload("Hello World"), Callback.NOOP, false); diff --git a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/JavaxWebSocketFrameHandler_OnMessage_TextStreamTest.java b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/JavaxWebSocketFrameHandler_OnMessage_TextStreamTest.java index 0891c15d484..8d9c739eb7f 100644 --- a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/JavaxWebSocketFrameHandler_OnMessage_TextStreamTest.java +++ b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/JavaxWebSocketFrameHandler_OnMessage_TextStreamTest.java @@ -29,8 +29,8 @@ import javax.websocket.server.ServerEndpoint; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.IO; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.javax.common.JavaxWebSocketFrameHandler; import org.eclipse.jetty.websocket.javax.common.UpgradeRequest; @@ -50,7 +50,7 @@ public class JavaxWebSocketFrameHandler_OnMessage_TextStreamTest extends Abstrac // Establish endpoint function JavaxWebSocketFrameHandler frameHandler = container.newFrameHandler(socket, request); - frameHandler.onOpen(new FrameHandler.CoreSession.Empty(), Callback.NOOP); + frameHandler.onOpen(new CoreSession.Empty(), Callback.NOOP); func.accept(frameHandler); return socket; } diff --git a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/LargeAnnotatedTest.java b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/LargeAnnotatedTest.java index 91a702836d1..e60bcae64fa 100644 --- a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/LargeAnnotatedTest.java +++ b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/LargeAnnotatedTest.java @@ -30,8 +30,8 @@ import org.eclipse.jetty.toolchain.test.jupiter.WorkDir; import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.webapp.WebAppContext; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient; import org.eclipse.jetty.websocket.javax.tests.WSServer; @@ -82,9 +82,9 @@ public class LargeAnnotatedTest FrameHandlerTracker clientSocket = new FrameHandlerTracker(); - Future clientConnectFuture = client.connect(clientSocket, uri.resolve("/app/echo/large")); + Future clientConnectFuture = client.connect(clientSocket, uri.resolve("/app/echo/large")); // wait for connect - FrameHandler.CoreSession coreSession = clientConnectFuture.get(1, TimeUnit.SECONDS); + CoreSession coreSession = clientConnectFuture.get(1, TimeUnit.SECONDS); coreSession.setMaxTextMessageSize(128 * 1024); try { diff --git a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/LargeContainerTest.java b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/LargeContainerTest.java index fbdf26ce9db..052e451e913 100644 --- a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/LargeContainerTest.java +++ b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/LargeContainerTest.java @@ -29,8 +29,8 @@ import org.eclipse.jetty.toolchain.test.jupiter.WorkDir; import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.webapp.WebAppContext; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient; import org.eclipse.jetty.websocket.javax.tests.WSServer; @@ -71,10 +71,10 @@ public class LargeContainerTest client.start(); FrameHandlerTracker clientSocket = new FrameHandlerTracker(); - Future clientConnectFuture = client.connect(clientSocket, uri.resolve("/app/echo/large")); + Future clientConnectFuture = client.connect(clientSocket, uri.resolve("/app/echo/large")); // wait for connect - FrameHandler.CoreSession coreSession = clientConnectFuture.get(5, TimeUnit.SECONDS); + CoreSession coreSession = clientConnectFuture.get(5, TimeUnit.SECONDS); coreSession.setMaxTextMessageSize(128 * 1024); try { diff --git a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/OnMessageReturnTest.java b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/OnMessageReturnTest.java index 1204b55304c..569bf6838af 100644 --- a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/OnMessageReturnTest.java +++ b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/OnMessageReturnTest.java @@ -32,8 +32,8 @@ import org.eclipse.jetty.toolchain.test.jupiter.WorkDir; import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.webapp.WebAppContext; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient; import org.eclipse.jetty.websocket.javax.tests.WSServer; @@ -105,10 +105,10 @@ public class OnMessageReturnTest client.start(); FrameHandlerTracker clientSocket = new FrameHandlerTracker(); - Future clientConnectFuture = client.connect(clientSocket, uri.resolve("/app/echoreturn")); + Future clientConnectFuture = client.connect(clientSocket, uri.resolve("/app/echoreturn")); // wait for connect - FrameHandler.CoreSession coreSession = clientConnectFuture.get(5, TimeUnit.SECONDS); + CoreSession coreSession = clientConnectFuture.get(5, TimeUnit.SECONDS); try { // Send message diff --git a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/PingPongTest.java b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/PingPongTest.java index e323ff87ea5..b7edff1a468 100644 --- a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/PingPongTest.java +++ b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/PingPongTest.java @@ -31,8 +31,8 @@ import com.acme.websocket.PongSocket; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.webapp.WebAppContext; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient; import org.eclipse.jetty.websocket.javax.tests.Timeouts; @@ -81,14 +81,14 @@ public class PingPongTest server.stop(); } - private void assertEcho(String endpointPath, Consumer sendAction, String... expectedMsgs) throws Exception + private void assertEcho(String endpointPath, Consumer sendAction, String... expectedMsgs) throws Exception { FrameHandlerTracker clientSocket = new FrameHandlerTracker(); URI toUri = server.getWsUri().resolve(endpointPath); // Connect - Future futureSession = client.connect(clientSocket, toUri); - FrameHandler.CoreSession coreSession = futureSession.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); + Future futureSession = client.connect(clientSocket, toUri); + CoreSession coreSession = futureSession.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS); try { // Apply send action diff --git a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/sockets/IdleTimeoutOnOpenSocket.java b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/sockets/IdleTimeoutOnOpenSocket.java index 5b9085c3a83..b0802a1e870 100644 --- a/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/sockets/IdleTimeoutOnOpenSocket.java +++ b/jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/sockets/IdleTimeoutOnOpenSocket.java @@ -24,7 +24,7 @@ import javax.websocket.OnOpen; import javax.websocket.Session; import javax.websocket.server.ServerEndpoint; -import org.eclipse.jetty.websocket.core.WebSocketTimeoutException; +import org.eclipse.jetty.websocket.core.exception.WebSocketTimeoutException; @ServerEndpoint(value = "/idle-onopen-socket") public class IdleTimeoutOnOpenSocket diff --git a/jetty-websocket/websocket-jetty-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java b/jetty-websocket/websocket-jetty-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java index c37ff27ecb9..bc7f5ffb859 100644 --- a/jetty-websocket/websocket-jetty-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java +++ b/jetty-websocket/websocket-jetty-client/src/main/java/org/eclipse/jetty/websocket/client/WebSocketClient.java @@ -52,7 +52,7 @@ import org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandler; import org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandlerFactory; import org.eclipse.jetty.websocket.common.SessionTracker; import org.eclipse.jetty.websocket.common.WebSocketContainer; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.WebSocketComponents; import org.eclipse.jetty.websocket.core.client.UpgradeListener; import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient; @@ -65,7 +65,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketPoli private final JettyWebSocketFrameHandlerFactory frameHandlerFactory; private final List sessionListeners = new CopyOnWriteArrayList<>(); private final SessionTracker sessionTracker = new SessionTracker(); - private final FrameHandler.ConfigurationCustomizer configurationCustomizer = new FrameHandler.ConfigurationCustomizer(); + private final Configuration.ConfigurationCustomizer configurationCustomizer = new Configuration.ConfigurationCustomizer(); private final WebSocketComponents components = new WebSocketComponents(); private boolean stopAtShutdown = false; diff --git a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/FunctionCallException.java b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/FunctionCallException.java index 41397859ed9..855dee065b3 100644 --- a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/FunctionCallException.java +++ b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/FunctionCallException.java @@ -20,7 +20,7 @@ package org.eclipse.jetty.websocket.common; import java.lang.reflect.InvocationTargetException; -import org.eclipse.jetty.websocket.core.WebSocketException; +import org.eclipse.jetty.websocket.core.exception.WebSocketException; public class FunctionCallException extends WebSocketException { diff --git a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandler.java b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandler.java index 9a2ccaa23e7..5242d3a8152 100644 --- a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandler.java +++ b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandler.java @@ -31,17 +31,19 @@ import org.eclipse.jetty.websocket.api.UpgradeRequest; import org.eclipse.jetty.websocket.api.UpgradeResponse; import org.eclipse.jetty.websocket.api.WriteCallback; import org.eclipse.jetty.websocket.common.invoke.InvalidSignatureException; -import org.eclipse.jetty.websocket.core.BadPayloadException; -import org.eclipse.jetty.websocket.core.CloseException; +import org.eclipse.jetty.websocket.core.Configuration; +import org.eclipse.jetty.websocket.core.CoreSession; +import org.eclipse.jetty.websocket.core.exception.BadPayloadException; +import org.eclipse.jetty.websocket.core.exception.CloseException; import org.eclipse.jetty.websocket.core.CloseStatus; import org.eclipse.jetty.websocket.core.Frame; import org.eclipse.jetty.websocket.core.FrameHandler; -import org.eclipse.jetty.websocket.core.MessageTooLargeException; +import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException; import org.eclipse.jetty.websocket.core.OpCode; -import org.eclipse.jetty.websocket.core.ProtocolException; -import org.eclipse.jetty.websocket.core.UpgradeException; -import org.eclipse.jetty.websocket.core.WebSocketException; -import org.eclipse.jetty.websocket.core.WebSocketTimeoutException; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; +import org.eclipse.jetty.websocket.core.exception.UpgradeException; +import org.eclipse.jetty.websocket.core.exception.WebSocketException; +import org.eclipse.jetty.websocket.core.exception.WebSocketTimeoutException; public class JettyWebSocketFrameHandler implements FrameHandler { @@ -70,7 +72,7 @@ public class JettyWebSocketFrameHandler implements FrameHandler private UpgradeRequest upgradeRequest; private UpgradeResponse upgradeResponse; - private final Customizer customizer; + private final Configuration.Customizer customizer; private MessageSink textSink; private MessageSink binarySink; private MessageSink activeMessageSink; @@ -87,7 +89,7 @@ public class JettyWebSocketFrameHandler implements FrameHandler MethodHandle frameHandle, MethodHandle pingHandle, MethodHandle pongHandle, BatchMode batchMode, - Customizer customizer) + Configuration.Customizer customizer) { this.log = Log.getLogger(endpointInstance.getClass()); diff --git a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandlerMetadata.java b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandlerMetadata.java index a99c2877d7a..1c4d3f41870 100644 --- a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandlerMetadata.java +++ b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandlerMetadata.java @@ -22,9 +22,9 @@ import java.lang.invoke.MethodHandle; import org.eclipse.jetty.websocket.api.BatchMode; import org.eclipse.jetty.websocket.api.InvalidWebSocketException; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.Configuration; -public class JettyWebSocketFrameHandlerMetadata extends FrameHandler.ConfigurationCustomizer +public class JettyWebSocketFrameHandlerMetadata extends Configuration.ConfigurationCustomizer { private MethodHandle openHandle; private MethodHandle closeHandle; diff --git a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketRemoteEndpoint.java b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketRemoteEndpoint.java index ca8c3b37fd9..76e1f69fccd 100644 --- a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketRemoteEndpoint.java +++ b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/JettyWebSocketRemoteEndpoint.java @@ -28,21 +28,21 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.SharedBlockingCallback; import org.eclipse.jetty.websocket.api.BatchMode; import org.eclipse.jetty.websocket.api.WriteCallback; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; -import org.eclipse.jetty.websocket.core.ProtocolException; +import org.eclipse.jetty.websocket.core.exception.ProtocolException; import static java.nio.charset.StandardCharsets.UTF_8; public class JettyWebSocketRemoteEndpoint implements org.eclipse.jetty.websocket.api.RemoteEndpoint { - private final FrameHandler.CoreSession coreSession; + private final CoreSession coreSession; private byte messageType = -1; private final SharedBlockingCallback blocker = new SharedBlockingCallback(); private BatchMode batchMode; - public JettyWebSocketRemoteEndpoint(FrameHandler.CoreSession coreSession, BatchMode batchMode) + public JettyWebSocketRemoteEndpoint(CoreSession coreSession, BatchMode batchMode) { this.coreSession = Objects.requireNonNull(coreSession); this.batchMode = batchMode; @@ -234,7 +234,7 @@ public class JettyWebSocketRemoteEndpoint implements org.eclipse.jetty.websocket } } - protected FrameHandler.CoreSession getCoreSession() + protected CoreSession getCoreSession() { return coreSession; } diff --git a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java index cdbeacf38ea..eaf3af890a2 100644 --- a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java +++ b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/WebSocketSession.java @@ -32,18 +32,18 @@ import org.eclipse.jetty.websocket.api.SuspendToken; import org.eclipse.jetty.websocket.api.UpgradeRequest; import org.eclipse.jetty.websocket.api.UpgradeResponse; import org.eclipse.jetty.websocket.api.WebSocketBehavior; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.CoreSession; public class WebSocketSession implements Session, SuspendToken, Dumpable { private static final Logger LOG = Log.getLogger(WebSocketSession.class); - private final FrameHandler.CoreSession coreSession; + private final CoreSession coreSession; private final JettyWebSocketFrameHandler frameHandler; private final JettyWebSocketRemoteEndpoint remoteEndpoint; private final UpgradeRequest upgradeRequest; private final UpgradeResponse upgradeResponse; - public WebSocketSession(FrameHandler.CoreSession coreSession, JettyWebSocketFrameHandler frameHandler) + public WebSocketSession(CoreSession coreSession, JettyWebSocketFrameHandler frameHandler) { this.frameHandler = Objects.requireNonNull(frameHandler); this.coreSession = Objects.requireNonNull(coreSession); @@ -235,7 +235,7 @@ public class WebSocketSession implements Session, SuspendToken, Dumpable frameHandler.resume(); } - public FrameHandler.CoreSession getCoreSession() + public CoreSession getCoreSession() { return coreSession; } diff --git a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/ByteArrayMessageSink.java b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/ByteArrayMessageSink.java index dc5b48a50f7..9cf8d8c91fd 100644 --- a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/ByteArrayMessageSink.java +++ b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/ByteArrayMessageSink.java @@ -31,7 +31,7 @@ import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.common.AbstractMessageSink; import org.eclipse.jetty.websocket.common.invoke.InvalidSignatureException; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.MessageTooLargeException; +import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException; public class ByteArrayMessageSink extends AbstractMessageSink { diff --git a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/ByteBufferMessageSink.java b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/ByteBufferMessageSink.java index d40d7ea1e0a..5e128c8540d 100644 --- a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/ByteBufferMessageSink.java +++ b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/ByteBufferMessageSink.java @@ -31,7 +31,7 @@ import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.common.AbstractMessageSink; import org.eclipse.jetty.websocket.common.invoke.InvalidSignatureException; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.MessageTooLargeException; +import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException; public class ByteBufferMessageSink extends AbstractMessageSink { diff --git a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageOutputStream.java b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageOutputStream.java index 0275496e9db..517c8702dbc 100644 --- a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageOutputStream.java +++ b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageOutputStream.java @@ -28,8 +28,8 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.SharedBlockingCallback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; /** @@ -39,7 +39,7 @@ public class MessageOutputStream extends OutputStream { private static final Logger LOG = Log.getLogger(MessageOutputStream.class); - private final FrameHandler.CoreSession coreSession; + private final CoreSession coreSession; private final ByteBufferPool bufferPool; private final SharedBlockingCallback blocker; private long frameCount; @@ -49,7 +49,7 @@ public class MessageOutputStream extends OutputStream private Callback callback; private boolean closed; - public MessageOutputStream(FrameHandler.CoreSession coreSession, int bufferSize, ByteBufferPool bufferPool) + public MessageOutputStream(CoreSession coreSession, int bufferSize, ByteBufferPool bufferPool) { this.coreSession = coreSession; this.bufferPool = bufferPool; diff --git a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageWriter.java b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageWriter.java index 534a7194039..fe2d3f5cbf4 100644 --- a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageWriter.java +++ b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/MessageWriter.java @@ -30,8 +30,8 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.SharedBlockingCallback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import static java.nio.charset.StandardCharsets.UTF_8; @@ -49,7 +49,7 @@ public class MessageWriter extends Writer .onUnmappableCharacter(CodingErrorAction.REPORT) .onMalformedInput(CodingErrorAction.REPORT); - private final FrameHandler.CoreSession coreSession; + private final CoreSession coreSession; private final SharedBlockingCallback blocker; private long frameCount; private Frame frame; @@ -57,7 +57,7 @@ public class MessageWriter extends Writer private Callback callback; private boolean closed; - public MessageWriter(FrameHandler.CoreSession coreSession, int bufferSize) + public MessageWriter(CoreSession coreSession, int bufferSize) { this.coreSession = coreSession; this.blocker = new SharedBlockingCallback(); diff --git a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/StringMessageSink.java b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/StringMessageSink.java index 8d2780bd5d2..68a246c7e08 100644 --- a/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/StringMessageSink.java +++ b/jetty-websocket/websocket-jetty-common/src/main/java/org/eclipse/jetty/websocket/common/message/StringMessageSink.java @@ -33,7 +33,7 @@ import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.common.AbstractMessageSink; import org.eclipse.jetty.websocket.common.invoke.InvalidSignatureException; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.MessageTooLargeException; +import org.eclipse.jetty.websocket.core.exception.MessageTooLargeException; public class StringMessageSink extends AbstractMessageSink { diff --git a/jetty-websocket/websocket-jetty-common/src/test/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandlerTest.java b/jetty-websocket/websocket-jetty-common/src/test/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandlerTest.java index 6ac2ec2d348..e39dbc4f135 100644 --- a/jetty-websocket/websocket-jetty-common/src/test/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandlerTest.java +++ b/jetty-websocket/websocket-jetty-common/src/test/java/org/eclipse/jetty/websocket/common/JettyWebSocketFrameHandlerTest.java @@ -38,8 +38,8 @@ import org.eclipse.jetty.websocket.common.endpoints.listeners.ListenerPartialSoc import org.eclipse.jetty.websocket.common.endpoints.listeners.ListenerPingPongSocket; import org.eclipse.jetty.websocket.core.Behavior; import org.eclipse.jetty.websocket.core.CloseStatus; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; @@ -67,7 +67,7 @@ public class JettyWebSocketFrameHandlerTest } private JettyWebSocketFrameHandlerFactory endpointFactory = new JettyWebSocketFrameHandlerFactory(container); - private FrameHandler.CoreSession coreSession = new FrameHandler.CoreSession.Empty() + private CoreSession coreSession = new CoreSession.Empty() { @Override public Behavior getBehavior() diff --git a/jetty-websocket/websocket-jetty-common/src/test/java/org/eclipse/jetty/websocket/common/OutgoingMessageCapture.java b/jetty-websocket/websocket-jetty-common/src/test/java/org/eclipse/jetty/websocket/common/OutgoingMessageCapture.java index 76164af7236..c1aee371c84 100644 --- a/jetty-websocket/websocket-jetty-common/src/test/java/org/eclipse/jetty/websocket/common/OutgoingMessageCapture.java +++ b/jetty-websocket/websocket-jetty-common/src/test/java/org/eclipse/jetty/websocket/common/OutgoingMessageCapture.java @@ -40,11 +40,11 @@ import org.eclipse.jetty.websocket.api.WebSocketBehavior; import org.eclipse.jetty.websocket.common.message.ByteBufferMessageSink; import org.eclipse.jetty.websocket.common.message.StringMessageSink; import org.eclipse.jetty.websocket.core.CloseStatus; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.Frame; -import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.OpCode; -public class OutgoingMessageCapture extends FrameHandler.CoreSession.Empty implements FrameHandler.CoreSession +public class OutgoingMessageCapture extends CoreSession.Empty implements CoreSession { private static final Logger LOG = Log.getLogger(OutgoingMessageCapture.class); diff --git a/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServerContainer.java b/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServerContainer.java index f9fa837f8d5..6ce4abe031e 100644 --- a/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServerContainer.java +++ b/jetty-websocket/websocket-jetty-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServerContainer.java @@ -38,9 +38,9 @@ import org.eclipse.jetty.websocket.api.WebSocketPolicy; import org.eclipse.jetty.websocket.api.WebSocketSessionListener; import org.eclipse.jetty.websocket.common.SessionTracker; import org.eclipse.jetty.websocket.common.WebSocketContainer; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.WebSocketComponents; -import org.eclipse.jetty.websocket.core.WebSocketException; +import org.eclipse.jetty.websocket.core.exception.WebSocketException; import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer; import org.eclipse.jetty.websocket.server.internal.JettyServerFrameHandlerFactory; import org.eclipse.jetty.websocket.servlet.FrameHandlerFactory; @@ -88,7 +88,7 @@ public class JettyWebSocketServerContainer extends ContainerLifeCycle implements private final WebSocketComponents webSocketComponents; private final FrameHandlerFactory frameHandlerFactory; private final Executor executor; - private final FrameHandler.ConfigurationCustomizer customizer = new FrameHandler.ConfigurationCustomizer(); + private final Configuration.ConfigurationCustomizer customizer = new Configuration.ConfigurationCustomizer(); private final List sessionListeners = new ArrayList<>(); private final SessionTracker sessionTracker = new SessionTracker(); diff --git a/jetty-websocket/websocket-jetty-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/ClientConnectTest.java b/jetty-websocket/websocket-jetty-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/ClientConnectTest.java index 2f9988dcaae..7fefb422b1a 100644 --- a/jetty-websocket/websocket-jetty-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/ClientConnectTest.java +++ b/jetty-websocket/websocket-jetty-tests/src/test/java/org/eclipse/jetty/websocket/tests/client/ClientConnectTest.java @@ -427,7 +427,7 @@ public class ClientConnectTest assertThat(jettyUpgradeException, instanceOf(UpgradeException.class)); Throwable coreUpgradeException = jettyUpgradeException.getCause(); - assertThat(coreUpgradeException, instanceOf(org.eclipse.jetty.websocket.core.UpgradeException.class)); + assertThat(coreUpgradeException, instanceOf(org.eclipse.jetty.websocket.core.exception.UpgradeException.class)); Throwable timeoutException = coreUpgradeException.getCause(); assertThat(timeoutException, instanceOf(TimeoutException.class)); diff --git a/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketMapping.java b/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketMapping.java index d9233a3b9ce..e0a54fd153d 100644 --- a/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketMapping.java +++ b/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketMapping.java @@ -36,9 +36,11 @@ import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.core.Configuration; +import org.eclipse.jetty.websocket.core.CoreSession; import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.WebSocketComponents; -import org.eclipse.jetty.websocket.core.WebSocketException; +import org.eclipse.jetty.websocket.core.exception.WebSocketException; import org.eclipse.jetty.websocket.core.server.Handshaker; import org.eclipse.jetty.websocket.core.server.Negotiation; import org.eclipse.jetty.websocket.core.server.WebSocketNegotiator; @@ -47,13 +49,13 @@ import static javax.servlet.http.HttpServletResponse.SC_SERVICE_UNAVAILABLE; /** * Mapping of pathSpec to a tupple of {@link WebSocketCreator}, {@link FrameHandlerFactory} and - * {@link org.eclipse.jetty.websocket.core.FrameHandler.Customizer}. + * {@link Configuration.Customizer}. *

- * When the {@link #upgrade(HttpServletRequest, HttpServletResponse, FrameHandler.Customizer)} + * When the {@link #upgrade(HttpServletRequest, HttpServletResponse, Configuration.Customizer)} * method is called, a match for the pathSpec is looked for. If one is found then the * creator is used to create a POJO for the WebSocket endpoint, the factory is used to * wrap that POJO with a {@link FrameHandler} and the customizer is used to configure the resulting - * {@link FrameHandler.CoreSession}.

+ * {@link CoreSession}.

*/ public class WebSocketMapping implements Dumpable, LifeCycle.Listener { @@ -187,7 +189,7 @@ public class WebSocketMapping implements Dumpable, LifeCycle.Listener * @param factory the factory to use to create a FrameHandler for the websocket * @param customizer the customizer to use to customize the WebSocket session. */ - public void addMapping(PathSpec pathSpec, WebSocketCreator creator, FrameHandlerFactory factory, FrameHandler.Customizer customizer) throws WebSocketException + public void addMapping(PathSpec pathSpec, WebSocketCreator creator, FrameHandlerFactory factory, Configuration.Customizer customizer) throws WebSocketException { mappings.put(pathSpec, new Negotiator(creator, factory, customizer)); } @@ -214,7 +216,7 @@ public class WebSocketMapping implements Dumpable, LifeCycle.Listener return mapping.getResource(); } - public boolean upgrade(HttpServletRequest request, HttpServletResponse response, FrameHandler.Customizer defaultCustomizer) throws IOException + public boolean upgrade(HttpServletRequest request, HttpServletResponse response, Configuration.Customizer defaultCustomizer) throws IOException { // Since this may be a filter, we need to be smart about determining the target path. // We should rely on the Container for stripping path parameters and its ilk before @@ -245,7 +247,7 @@ public class WebSocketMapping implements Dumpable, LifeCycle.Listener private final WebSocketCreator creator; private final FrameHandlerFactory factory; - public Negotiator(WebSocketCreator creator, FrameHandlerFactory factory, FrameHandler.Customizer customizer) + public Negotiator(WebSocketCreator creator, FrameHandlerFactory factory, Configuration.Customizer customizer) { super(components, customizer); this.creator = creator; diff --git a/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketServlet.java b/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketServlet.java index c818781d191..6351e5537be 100644 --- a/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketServlet.java +++ b/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketServlet.java @@ -31,7 +31,7 @@ import org.eclipse.jetty.http.pathmap.PathSpec; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.WebSocketComponents; import org.eclipse.jetty.websocket.core.WebSocketExtensionRegistry; @@ -181,7 +181,7 @@ public abstract class WebSocketServlet extends HttpServlet super.service(req, resp); } - private class CustomizedWebSocketServletFactory extends FrameHandler.ConfigurationCustomizer implements WebSocketServletFactory + private class CustomizedWebSocketServletFactory extends Configuration.ConfigurationCustomizer implements WebSocketServletFactory { @Override public WebSocketExtensionRegistry getExtensionRegistry() diff --git a/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketServletFactory.java b/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketServletFactory.java index d659b9a95a3..e379d2d61c4 100644 --- a/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketServletFactory.java +++ b/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketServletFactory.java @@ -21,10 +21,10 @@ package org.eclipse.jetty.websocket.servlet; import java.time.Duration; import org.eclipse.jetty.http.pathmap.PathSpec; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.WebSocketExtensionRegistry; -public interface WebSocketServletFactory extends FrameHandler.Configuration +public interface WebSocketServletFactory extends Configuration { WebSocketExtensionRegistry getExtensionRegistry(); diff --git a/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketUpgradeFilter.java b/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketUpgradeFilter.java index af5c385e75f..9b107a5ca95 100644 --- a/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketUpgradeFilter.java +++ b/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketUpgradeFilter.java @@ -40,7 +40,7 @@ import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.core.FrameHandler; +import org.eclipse.jetty.websocket.core.Configuration; import org.eclipse.jetty.websocket.core.WebSocketComponents; /** @@ -125,7 +125,7 @@ public class WebSocketUpgradeFilter implements Filter, Dumpable public static final String MAPPING_ATTRIBUTE_INIT_PARAM = "org.eclipse.jetty.websocket.servlet.WebSocketMapping.key"; - private final FrameHandler.ConfigurationCustomizer defaultCustomizer = new FrameHandler.ConfigurationCustomizer(); + private final Configuration.ConfigurationCustomizer defaultCustomizer = new Configuration.ConfigurationCustomizer(); private WebSocketMapping mapping; @Override