Clean up websocket-core package structure

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2019-12-30 15:41:02 +11:00
parent f1838c5f88
commit 356e98f737
114 changed files with 758 additions and 679 deletions

View File

@ -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;

View File

@ -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

View File

@ -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 &amp; reason)

View File

@ -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 &lt;= 0 implies an infinite timeout)
*/
void setIdleTimeout(Duration timeout);
/**
* Set the Write Timeout.
*
* @param timeout the timeout duration (timeout &lt;= 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;
}
}
}

View File

@ -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<ExtensionConfig> getNegotiatedExtensions();
/**
* The parameter map (from URI Query) for the active session.
*
* @return the immutable map of parameters
*/
Map<String, List<String>> 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
* <p>
* 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}
* </p>
*
* @return the SocketAddress for the local connection, or null if not supported by Session
*/
SocketAddress getLocalAddress();
/**
* The Remote Socket Address for the connection
* <p>
* 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}
* </p>
*
* @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.
* <p>
* This will terminate the connection, without sending a websocket close frame.
* No WebSocket Protocol close handshake will be performed.
* </p>
* <p>
* 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.
* </p>
* <p>
* Once the underlying connection has been determined to be closed, the {@link FrameHandler#onClosed(CloseStatus, Callback)} event will be called.
* </p>
*/
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<ExtensionConfig> getNegotiatedExtensions()
{
return null;
}
@Override
public Map<String, List<String>> 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)
{
}
}
}

View File

@ -18,8 +18,6 @@
package org.eclipse.jetty.websocket.core;
import org.eclipse.jetty.websocket.core.FrameHandler.Configuration;
/**
* Interface for WebSocket Extensions.
* <p>

View File

@ -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 &lt;= 0 implies an infinite timeout)
*/
void setIdleTimeout(Duration timeout);
/**
* Set the Write Timeout.
*
* @param timeout the timeout duration (timeout &lt;= 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<ExtensionConfig> getNegotiatedExtensions();
/**
* The parameter map (from URI Query) for the active session.
*
* @return the immutable map of parameters
*/
Map<String, List<String>> 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
* <p>
* 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}
* </p>
*
* @return the SocketAddress for the local connection, or null if not supported by Session
*/
SocketAddress getLocalAddress();
/**
* The Remote Socket Address for the connection
* <p>
* 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}
* </p>
*
* @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.
* <p>
* This will terminate the connection, without sending a websocket close frame.
* No WebSocket Protocol close handshake will be performed.
* </p>
* <p>
* 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.
* </p>
* <p>
* Once the underlying connection has been determined to be closed, the {@link #onClosed(CloseStatus, Callback)} event will be called.
* </p>
*/
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<ExtensionConfig> getNegotiatedExtensions()
{
return null;
}
@Override
public Map<String, List<String>> 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;
}
}
}

View File

@ -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
{

View File

@ -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<FrameHandler.CoreSession> futureCoreSession;
protected final CompletableFuture<CoreSession> futureCoreSession;
private final WebSocketCoreClient wsClient;
private FrameHandler frameHandler;
private FrameHandler.ConfigurationCustomizer customizer = new FrameHandler.ConfigurationCustomizer();
private Configuration.ConfigurationCustomizer customizer = new Configuration.ConfigurationCustomizer();
private List<UpgradeListener> upgradeListeners = new ArrayList<>();
private List<ExtensionConfig> 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<FrameHandler.CoreSession> sendAsync()
public CompletableFuture<CoreSession> sendAsync()
{
send(this);
return futureCoreSession;

View File

@ -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<FrameHandler.CoreSession> connect(FrameHandler frameHandler, URI wsUri) throws IOException
public CompletableFuture<CoreSession> connect(FrameHandler frameHandler, URI wsUri) throws IOException
{
ClientUpgradeRequest request = ClientUpgradeRequest.from(this, wsUri, frameHandler);
return connect(request);
}
public CompletableFuture<FrameHandler.CoreSession> connect(ClientUpgradeRequest request) throws IOException
public CompletableFuture<CoreSession> connect(ClientUpgradeRequest request) throws IOException
{
if (!isStarted())
throw new IllegalStateException(WebSocketCoreClient.class.getSimpleName() + "@" + this.hashCode() + " is not started");

View File

@ -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

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core;
package org.eclipse.jetty.websocket.core.exception;
@SuppressWarnings("serial")
public class CloseException extends WebSocketException

View File

@ -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.

View File

@ -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)

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core;
package org.eclipse.jetty.websocket.core.exception;
import java.net.URI;

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core;
package org.eclipse.jetty.websocket.core.exception;
/**
* A recoverable exception within the websocket framework.

View File

@ -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.

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core;
package org.eclipse.jetty.websocket.core.exception;
public class WebSocketWriteTimeoutException extends WebSocketTimeoutException
{

View File

@ -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.

View File

@ -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()
{

View File

@ -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;
/**

View File

@ -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
{

View File

@ -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
{

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.core;
package org.eclipse.jetty.websocket.core.internal;
import org.eclipse.jetty.util.Utf8Appendable;

View File

@ -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.

View File

@ -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;
/**

View File

@ -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);

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -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;
}

View File

@ -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<Negotiation, FrameHandler> negotiate, FrameHandler.Customizer customizer)
static WebSocketNegotiator from(Function<Negotiation, FrameHandler> negotiate, Configuration.Customizer customizer)
{
return new AbstractNegotiator(null, customizer)
{
@ -66,7 +67,7 @@ public interface WebSocketNegotiator extends FrameHandler.Customizer
static WebSocketNegotiator from(
Function<Negotiation, FrameHandler> 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;
}

View File

@ -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;

View File

@ -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) ||

View File

@ -74,7 +74,7 @@ public class AutoFragmentTest
public void testOutgoingAutoFragmentToMaxFrameSize() throws Exception
{
TestFrameHandler clientHandler = new TestFrameHandler();
CompletableFuture<FrameHandler.CoreSession> connect = client.connect(clientHandler, serverUri);
CompletableFuture<CoreSession> 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<FrameHandler.CoreSession> connect = client.connect(clientHandler, serverUri);
CompletableFuture<CoreSession> 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<FrameHandler.CoreSession> connect = client.connect(upgradeRequest);
CompletableFuture<CoreSession> 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<FrameHandler.CoreSession> connect = client.connect(upgradeRequest);
CompletableFuture<CoreSession> 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<FrameHandler.CoreSession> connect = client.connect(upgradeRequest);
CompletableFuture<CoreSession> connect = client.connect(upgradeRequest);
connect.get(5, TimeUnit.SECONDS);
// Turn off fragmentation on the client.

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -53,7 +53,7 @@ public class TestWebSocketNegotiator implements WebSocketNegotiator
}
@Override
public void customize(FrameHandler.Configuration configurable)
public void customize(Configuration configurable)
{
}

View File

@ -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;

View File

@ -59,7 +59,7 @@ public class WebSocketOpenTest extends WebSocketTester
server.stop();
}
public void setup(BiFunction<FrameHandler.CoreSession, Callback, Void> onOpen) throws Exception
public void setup(BiFunction<CoreSession, Callback, Void> 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<FrameHandler.CoreSession> sx = new Exchanger<>();
Exchanger<CoreSession> sx = new Exchanger<>();
Exchanger<Callback> 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);

View File

@ -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

View File

@ -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<FrameHandler.CoreSession> response = client.connect(onCaseCount, wsUri);
Future<CoreSession> 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<FrameHandler.CoreSession> response = client.connect(echoHandler, wsUri);
Future<CoreSession> 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<FrameHandler.CoreSession> response = client.connect(onUpdateReports, wsUri);
Future<CoreSession> 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<FrameHandler.CoreSession> response) throws InterruptedException
private boolean waitForUpgrade(URI wsUri, Future<CoreSession> response) throws InterruptedException
{
try
{

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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<FrameHandler.CoreSession> connect = client.connect(upgradeRequest);
CompletableFuture<CoreSession> 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<FrameHandler.CoreSession> connect = client.connect(upgradeRequest);
CompletableFuture<CoreSession> 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<FrameHandler.CoreSession> connect = client.connect(upgradeRequest);
CompletableFuture<CoreSession> 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<FrameHandler.CoreSession> connect = client.connect(upgradeRequest);
CompletableFuture<CoreSession> connect = client.connect(upgradeRequest);
connect.get(5, TimeUnit.SECONDS);
// Make sure the internal parameter was not sent from the server.

View File

@ -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;

View File

@ -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;

View File

@ -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");

View File

@ -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;

View File

@ -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.

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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<JavaxWebSocketSessionListener> sessionListeners = new ArrayList<>();
protected FrameHandler.ConfigurationCustomizer defaultCustomizer = new FrameHandler.ConfigurationCustomizer();
protected Configuration.ConfigurationCustomizer defaultCustomizer = new Configuration.ConfigurationCustomizer();
protected WebSocketComponents components;
public JavaxWebSocketContainer(WebSocketComponents components)

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();

View File

@ -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

View File

@ -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<String, String> uriParams;
protected EndpointConfig endpointConfig;
protected FrameHandler.CoreSession coreSession = new FrameHandler.CoreSession.Empty();
protected CoreSession coreSession = new CoreSession.Empty();
public AbstractJavaxWebSocketFrameHandlerTest()
{

View File

@ -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));
}

View File

@ -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<Frame> 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<String> messages = new LinkedBlockingQueue<>();

View File

@ -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;

View File

@ -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)
{
}
}

View File

@ -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<FrameHandler.CoreSession> futureHandler = this.client.connect(upgradeRequest);
CompletableFuture<CoreSession> futureHandler = this.client.connect(upgradeRequest);
CompletableFuture<FrameCapture> futureCapture = futureHandler.thenCombine(upgradeRequest.getFuture(), (session, capture) -> capture);
this.frameCapture = futureCapture.get(10, TimeUnit.SECONDS);
}

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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());
}

View File

@ -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);

View File

@ -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);

View File

@ -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();

View File

@ -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;

View File

@ -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<FrameHandler.CoreSession> clientConnectFuture = client.connect(upgradeRequest);
Future<CoreSession> 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<FrameHandler.CoreSession> clientConnectFuture = client.connect(upgradeRequest);
Future<CoreSession> 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<FrameHandler.CoreSession> clientConnectFuture = client.connect(upgradeRequest);
Future<CoreSession> 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<FrameHandler.CoreSession> clientConnectFuture = client.connect(upgradeRequest);
Future<CoreSession> 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<FrameHandler.CoreSession> clientConnectFuture = client.connect(upgradeRequest);
Future<CoreSession> 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<FrameHandler.CoreSession> clientConnectFuture = client.connect(upgradeRequest);
Future<CoreSession> 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<FrameHandler.CoreSession> clientConnectFuture = client.connect(upgradeRequest);
Future<CoreSession> 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<FrameHandler.CoreSession> clientConnectFuture = client.connect(upgradeRequest);
Future<CoreSession> 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<FrameHandler.CoreSession> clientConnectFuture = client.connect(upgradeRequest);
Future<CoreSession> clientConnectFuture = client.connect(upgradeRequest);
assertProtocols(clientSocket, clientConnectFuture, is("Requested Protocols: [echo,chat,status]"));
}
protected void assertProtocols(FrameHandlerTracker clientSocket, Future<FrameHandler.CoreSession> clientConnectFuture, Matcher<String> responseMatcher)
protected void assertProtocols(FrameHandlerTracker clientSocket, Future<CoreSession> clientConnectFuture, Matcher<String> 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<FrameHandler.CoreSession> clientConnectFuture = client.connect(upgradeRequest);
Future<CoreSession> 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);

View File

@ -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<FrameHandler.CoreSession> clientConnectFuture = client.connect(clientSocket, uri.resolve("/app/echo"));
Future<CoreSession> 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);

View File

@ -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;
}

View File

@ -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<FrameHandler.CoreSession> clientConnectFuture = client.connect(clientSocket, uri.resolve("/app/echo/large"));
Future<CoreSession> 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
{

View File

@ -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<FrameHandler.CoreSession> clientConnectFuture = client.connect(clientSocket, uri.resolve("/app/echo/large"));
Future<CoreSession> 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
{

View File

@ -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<FrameHandler.CoreSession> clientConnectFuture = client.connect(clientSocket, uri.resolve("/app/echoreturn"));
Future<CoreSession> 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

View File

@ -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<FrameHandler.CoreSession> sendAction, String... expectedMsgs) throws Exception
private void assertEcho(String endpointPath, Consumer<CoreSession> sendAction, String... expectedMsgs) throws Exception
{
FrameHandlerTracker clientSocket = new FrameHandlerTracker();
URI toUri = server.getWsUri().resolve(endpointPath);
// Connect
Future<FrameHandler.CoreSession> futureSession = client.connect(clientSocket, toUri);
FrameHandler.CoreSession coreSession = futureSession.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS);
Future<CoreSession> futureSession = client.connect(clientSocket, toUri);
CoreSession coreSession = futureSession.get(Timeouts.CONNECT_MS, TimeUnit.MILLISECONDS);
try
{
// Apply send action

View File

@ -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

View File

@ -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<WebSocketSessionListener> 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;

View File

@ -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
{

View File

@ -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());

View File

@ -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;

View File

@ -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;
}

Some files were not shown because too many files have changed in this diff Show More