Fixes #9391 - port/move Jetty WebSocket APIs, client and server to je… (#9469)

* Moved -api, -common, -client to jetty-core/jetty-websocket.
* Implemented jetty-core/jetty-websocket/jetty-websocket-jetty-server using only Jetty core APIs, not Servlet.
* Fixed Graceful shutdown order.
* Fixed mistakes in HttpFieldsWrapper, wrongly calling HttpHeader.name() instead of asString().
* Updated tests to pass cleanly.
* Fixed BOMs and POM dependencies.
* Introduced websocket-jetty.mod and websocket-jetty-client.mod, now used by ee10's Jetty WebSocket.
* Fixed OSGi references to old artifactIds.
* Added test to show how to lookup and use ServerWebSocketContainer from a Handler.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2023-03-24 19:42:51 +01:00 committed by GitHub
parent 3732b38eb2
commit 856d3338f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
253 changed files with 3307 additions and 1766 deletions

View File

@ -256,16 +256,16 @@
<artifactId>jetty-nosql</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee10.websocket</groupId>
<artifactId>jetty-ee10-websocket-jetty-client</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee10.websocket</groupId>
<artifactId>jetty-ee10-websocket-jakarta-server</artifactId>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket-jetty-client</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee10.websocket</groupId>
<artifactId>jetty-ee10-websocket-jetty-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee10.websocket</groupId>
<artifactId>jetty-ee10-websocket-jakarta-server</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -20,20 +20,20 @@ import java.nio.ByteBuffer;
import java.nio.file.Path;
import java.time.Duration;
import org.eclipse.jetty.ee10.websocket.api.RemoteEndpoint;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.api.StatusCode;
import org.eclipse.jetty.ee10.websocket.api.WebSocketListener;
import org.eclipse.jetty.ee10.websocket.api.WebSocketPartialListener;
import org.eclipse.jetty.ee10.websocket.api.WebSocketPingPongListener;
import org.eclipse.jetty.ee10.websocket.api.WriteCallback;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketClose;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketError;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.ee10.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.util.IteratingCallback;
import org.eclipse.jetty.util.NanoTime;
import org.eclipse.jetty.websocket.api.RemoteEndpoint;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.WebSocketListener;
import org.eclipse.jetty.websocket.api.WebSocketPartialListener;
import org.eclipse.jetty.websocket.api.WebSocketPingPongListener;
import org.eclipse.jetty.websocket.api.WriteCallback;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketError;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
@SuppressWarnings("unused")
public class WebSocketDocs

View File

@ -22,14 +22,14 @@ import org.eclipse.jetty.client.HttpProxy;
import org.eclipse.jetty.client.Request;
import org.eclipse.jetty.client.Response;
import org.eclipse.jetty.client.transport.HttpClientTransportDynamic;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.ee10.websocket.client.JettyUpgradeListener;
import org.eclipse.jetty.ee10.websocket.client.WebSocketClient;
import org.eclipse.jetty.http2.client.HTTP2Client;
import org.eclipse.jetty.http2.client.transport.ClientConnectionFactoryOverHTTP2;
import org.eclipse.jetty.http2.client.transport.HttpClientTransportOverHTTP2;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.JettyUpgradeListener;
import org.eclipse.jetty.websocket.client.WebSocketClient;
@SuppressWarnings("unused")
public class WebSocketClientDocs

View File

@ -26,7 +26,6 @@ import jakarta.websocket.server.ServerEndpoint;
import jakarta.websocket.server.ServerEndpointConfig;
import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
import org.eclipse.jetty.ee10.webapp.WebAppContext;
import org.eclipse.jetty.ee10.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.ee10.websocket.jakarta.server.config.JakartaWebSocketServletContainerInitializer;
import org.eclipse.jetty.ee10.websocket.server.JettyWebSocketCreator;
import org.eclipse.jetty.ee10.websocket.server.JettyWebSocketServerContainer;
@ -34,6 +33,7 @@ import org.eclipse.jetty.ee10.websocket.server.JettyWebSocketServlet;
import org.eclipse.jetty.ee10.websocket.server.JettyWebSocketServletFactory;
import org.eclipse.jetty.ee10.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
@SuppressWarnings("unused")
public class WebSocketServerDocs

View File

@ -371,21 +371,6 @@
<artifactId>jetty-webapp</artifactId>
<version>12.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-jakarta-client</artifactId>
<version>12.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-jakarta-server</artifactId>
<version>12.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-jakarta-common</artifactId>
<version>12.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-jetty-api</artifactId>
@ -406,11 +391,6 @@
<artifactId>websocket-jetty-server</artifactId>
<version>12.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-servlet</artifactId>
<version>12.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket-core-common</artifactId>

View File

@ -307,6 +307,26 @@
<artifactId>jetty-websocket-core-server</artifactId>
<version>12.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket-jetty-api</artifactId>
<version>12.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket-jetty-client</artifactId>
<version>12.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket-jetty-common</artifactId>
<version>12.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket-jetty-server</artifactId>
<version>12.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-xml</artifactId>

View File

@ -14,6 +14,7 @@
package org.eclipse.jetty.util.component;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
@ -143,6 +144,10 @@ public interface Graceful
if (log.isDebugEnabled())
gracefuls.forEach(g -> log.debug("Graceful {}", g));
// Call shutdown() on the gracefuls in reverse order.
// Inner components may send network bytes to close connections
// and must run before the ServerConnector closes the EndPoints.
Collections.reverse(gracefuls);
return CompletableFuture.allOf(gracefuls.stream().map(Graceful::shutdown).toArray(CompletableFuture[]::new));
}

View File

@ -1,2 +0,0 @@
# Empty on purpose
# TODO delete me after beta release

View File

@ -133,6 +133,11 @@ public class WebSocketMappings implements Dumpable, LifeCycle.Listener
this.components = components;
}
public WebSocketComponents getWebSocketComponents()
{
return components;
}
public Handshaker getHandshaker()
{
return handshaker;

View File

@ -57,7 +57,7 @@ public class HttpFieldsWrapper implements HttpFields.Mutable
@Override
public Mutable add(HttpHeader header, HttpHeaderValue value)
{
if (onAddField(header.name(), value.asString()))
if (onAddField(header.asString(), value.asString()))
return _fields.add(header, value);
return this;
}
@ -65,7 +65,7 @@ public class HttpFieldsWrapper implements HttpFields.Mutable
@Override
public Mutable add(HttpHeader header, String value)
{
if (onAddField(header.name(), value))
if (onAddField(header.asString(), value))
return _fields.add(header, value);
return this;
}
@ -125,7 +125,7 @@ public class HttpFieldsWrapper implements HttpFields.Mutable
@Override
public Mutable put(HttpHeader header, HttpHeaderValue value)
{
if (onPutField(header.name(), value.asString()))
if (onPutField(header.asString(), value.asString()))
return _fields.put(header, value);
return this;
}
@ -133,7 +133,7 @@ public class HttpFieldsWrapper implements HttpFields.Mutable
@Override
public Mutable put(HttpHeader header, String value)
{
if (onPutField(header.name(), value))
if (onPutField(header.asString(), value))
return _fields.put(header, value);
return this;
}
@ -141,7 +141,7 @@ public class HttpFieldsWrapper implements HttpFields.Mutable
@Override
public Mutable remove(HttpHeader header)
{
if (onRemoveField(header.name()))
if (onRemoveField(header.asString()))
return _fields.remove(header);
return this;
}

View File

@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.jetty.http.HttpFields;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.server.Response;
import org.eclipse.jetty.websocket.core.ExtensionConfig;
import org.eclipse.jetty.websocket.core.server.ServerUpgradeResponse;
@ -55,6 +56,8 @@ public class ServerUpgradeResponseImpl extends Response.Wrapper implements Serve
public void setAcceptedSubProtocol(String protocol)
{
negotiation.setSubprotocol(protocol);
// Use the nested headers (not the wrapped ones) to avoid infinite recursion.
response.getHeaders().put(HttpHeader.SEC_WEBSOCKET_SUBPROTOCOL, protocol);
}
@Override

View File

@ -21,7 +21,6 @@ import java.util.stream.Collectors;
import org.eclipse.jetty.http.BadMessageException;
import org.eclipse.jetty.http.HttpField;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.QuotedCSV;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Response;
@ -157,7 +156,6 @@ public abstract class WebSocketNegotiation
public void setSubprotocol(String protocol)
{
this.protocol = protocol;
response.getHeaders().put(HttpHeader.SEC_WEBSOCKET_SUBPROTOCOL, protocol);
}
public List<String> getOfferedSubprotocols()

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty.ee10.websocket</groupId>
<artifactId>jetty-ee10-websocket</artifactId>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-ee10-websocket-jetty-api</artifactId>
<name>EE10 :: Websocket :: Jetty API</name>
<artifactId>jetty-websocket-jetty-api</artifactId>
<name>Core :: Websocket :: Jetty API</name>
<properties>
<bundle-symbolic-name>${project.groupId}.api</bundle-symbolic-name>

View File

@ -0,0 +1,24 @@
//
// ========================================================================
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//
import org.eclipse.jetty.websocket.api.ExtensionConfig;
module org.eclipse.jetty.websocket.api
{
exports org.eclipse.jetty.websocket.api;
exports org.eclipse.jetty.websocket.api.annotations;
exports org.eclipse.jetty.websocket.api.exceptions;
exports org.eclipse.jetty.websocket.api.util;
uses ExtensionConfig.Parser;
}

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
/**
* The possible batch modes when enqueuing outgoing frames.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
public class CloseStatus
{

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
import java.util.Map;
import java.util.ServiceLoader;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
import java.nio.ByteBuffer;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
import java.io.IOException;
import java.net.SocketAddress;

View File

@ -11,13 +11,13 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
import java.io.Closeable;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketClose;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose;
/**
* Session represents an active link of communications with a Remote WebSocket Endpoint.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
/**
* The <a href="https://tools.ietf.org/html/rfc6455#section-7.4">RFC 6455 specified status codes</a> and <a

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
/**
* Connection suspend token

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
import java.net.HttpCookie;
import java.net.URI;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
import java.util.List;
import java.util.Map;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
/**
* Default implementation of the {@link WebSocketListener}.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
/**
* Behavior for how the WebSocket should operate.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
/**
* Core WebSocket Connection Listener

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
import java.util.Collection;
import java.util.concurrent.Executor;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
/**
* WebSocket Frame Listener interface for incoming WebSocket frames.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
/**
* Basic WebSocket Listener interface for incoming WebSocket message events.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
import java.nio.ByteBuffer;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
import java.nio.ByteBuffer;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
import java.time.Duration;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
/**
* Interface for Listeners that are interested in knowing about the Session history.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api;
package org.eclipse.jetty.websocket.api;
/**
* Callback for Write events.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.annotations;
package org.eclipse.jetty.websocket.api.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@ -19,7 +19,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.websocket.api.Session;
/**
* Annotation for tagging methods to receive connection close events.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.annotations;
package org.eclipse.jetty.websocket.api.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@ -19,7 +19,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.websocket.api.Session;
/**
* Annotation for tagging methods to receive connection open events.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.annotations;
package org.eclipse.jetty.websocket.api.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@ -19,7 +19,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.websocket.api.Session;
/**
* Annotation for receiving websocket errors (exceptions) that have occurred internally in the websocket implementation.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.annotations;
package org.eclipse.jetty.websocket.api.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@ -19,8 +19,8 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.eclipse.jetty.ee10.websocket.api.Frame;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.websocket.api.Frame;
import org.eclipse.jetty.websocket.api.Session;
/**
* (ADVANCED) Annotation for tagging methods to receive frame events.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.annotations;
package org.eclipse.jetty.websocket.api.annotations;
import java.io.Reader;
import java.lang.annotation.Documented;
@ -20,8 +20,8 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.api.WebSocketPartialListener;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.WebSocketPartialListener;
/**
* Annotation for tagging methods to receive Binary or Text Message events.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.annotations;
package org.eclipse.jetty.websocket.api.annotations;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@ -19,8 +19,8 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.eclipse.jetty.ee10.websocket.api.BatchMode;
import org.eclipse.jetty.ee10.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.BatchMode;
import org.eclipse.jetty.websocket.api.StatusCode;
/**
* Tags a POJO as being a WebSocket class.

View File

@ -14,5 +14,5 @@
/**
* Jetty WebSocket API : WebSocket POJO Annotations
*/
package org.eclipse.jetty.ee10.websocket.api.annotations;
package org.eclipse.jetty.websocket.api.annotations;

View File

@ -11,9 +11,9 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.exceptions;
package org.eclipse.jetty.websocket.api.exceptions;
import org.eclipse.jetty.ee10.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.StatusCode;
/**
* 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

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.exceptions;
package org.eclipse.jetty.websocket.api.exceptions;
@SuppressWarnings("serial")
public class CloseException extends WebSocketException

View File

@ -11,11 +11,11 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.exceptions;
package org.eclipse.jetty.websocket.api.exceptions;
import org.eclipse.jetty.ee10.websocket.api.WebSocketAdapter;
import org.eclipse.jetty.ee10.websocket.api.WebSocketListener;
import org.eclipse.jetty.ee10.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.websocket.api.WebSocketAdapter;
import org.eclipse.jetty.websocket.api.WebSocketListener;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
/**
* Indicating that the provided Class is not a valid WebSocket as defined by the API.

View File

@ -11,9 +11,9 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.exceptions;
package org.eclipse.jetty.websocket.api.exceptions;
import org.eclipse.jetty.ee10.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.StatusCode;
/**
* Exception when a message is too large for the internal buffers occurs and should trigger a connection close.

View File

@ -11,9 +11,9 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.exceptions;
package org.eclipse.jetty.websocket.api.exceptions;
import org.eclipse.jetty.ee10.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.StatusCode;
/**
* Exception when a violation of policy occurs and should trigger a connection close.

View File

@ -11,9 +11,9 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.exceptions;
package org.eclipse.jetty.websocket.api.exceptions;
import org.eclipse.jetty.ee10.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.StatusCode;
/**
* Per spec, a protocol error should result in a Close frame of status code 1002 (PROTOCOL_ERROR)

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.exceptions;
package org.eclipse.jetty.websocket.api.exceptions;
import java.net.URI;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.exceptions;
package org.eclipse.jetty.websocket.api.exceptions;
/**
* A recoverable exception within the websocket framework.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.exceptions;
package org.eclipse.jetty.websocket.api.exceptions;
/**
* Exception thrown to indicate a connection I/O timeout.

View File

@ -14,5 +14,5 @@
/**
* Jetty WebSocket API : Exception Types
*/
package org.eclipse.jetty.ee10.websocket.api.exceptions;
package org.eclipse.jetty.websocket.api.exceptions;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.util;
package org.eclipse.jetty.websocket.api.util;
import java.net.URI;
import java.net.URISyntaxException;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.api.util;
package org.eclipse.jetty.websocket.api.util;
public final class WebSocketConstants
{

View File

@ -14,5 +14,5 @@
/**
* Jetty WebSocket API : Utility Classes
*/
package org.eclipse.jetty.ee10.websocket.api.util;
package org.eclipse.jetty.websocket.api.util;

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-websocket-jetty-client</artifactId>
<name>Core :: Websocket :: Jetty Client</name>
<properties>
<bundle-symbolic-name>${project.groupId}.client</bundle-symbolic-name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Require-Capability>
osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)"
</Require-Capability>
<Provide-Capability>
osgi.serviceloader; osgi.serviceloader=org.eclipse.jetty.ee10.webapp.Configuration
</Provide-Capability>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket-jetty-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket-jetty-common</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket-core-client</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-slf4j-impl</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,15 @@
[description]
Expose the Jetty WebSocket Client classes to deployed web applications.
[tags]
websocket
[depend]
client
[lib]
lib/jetty-websocket-core-common-${jetty.version}.jar
lib/jetty-websocket-core-client-${jetty.version}.jar
lib/jetty-websocket-jetty-api-${jetty.version}.jar
lib/jetty-websocket-jetty-common-${jetty.version}.jar
lib/jetty-websocket-jetty-client-${jetty.version}.jar

View File

@ -0,0 +1,24 @@
//
// ========================================================================
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others.
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
// which is available at https://www.apache.org/licenses/LICENSE-2.0.
//
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
// ========================================================================
//
module org.eclipse.jetty.websocket.client
{
requires org.eclipse.jetty.websocket.core.client;
requires org.eclipse.jetty.websocket.common;
requires org.slf4j;
requires transitive org.eclipse.jetty.client;
requires transitive org.eclipse.jetty.websocket.api;
exports org.eclipse.jetty.websocket.client;
}

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.client;
package org.eclipse.jetty.websocket.client;
import java.net.HttpCookie;
import java.net.URI;
@ -24,11 +24,11 @@ import java.util.Objects;
import java.util.TreeMap;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.ee10.websocket.api.ExtensionConfig;
import org.eclipse.jetty.ee10.websocket.api.UpgradeRequest;
import org.eclipse.jetty.ee10.websocket.api.UpgradeResponse;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpScheme;
import org.eclipse.jetty.websocket.api.ExtensionConfig;
import org.eclipse.jetty.websocket.api.UpgradeRequest;
import org.eclipse.jetty.websocket.api.UpgradeResponse;
/**
* Client based UpgradeRequest API

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.client;
package org.eclipse.jetty.websocket.client;
import org.eclipse.jetty.client.Request;
import org.eclipse.jetty.client.Response;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.client;
package org.eclipse.jetty.websocket.client;
import java.io.IOException;
import java.net.SocketAddress;
@ -29,22 +29,21 @@ import java.util.function.Consumer;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.Request;
import org.eclipse.jetty.client.Response;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.api.WebSocketBehavior;
import org.eclipse.jetty.ee10.websocket.api.WebSocketContainer;
import org.eclipse.jetty.ee10.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.ee10.websocket.api.WebSocketSessionListener;
import org.eclipse.jetty.ee10.websocket.client.impl.JettyClientUpgradeRequest;
import org.eclipse.jetty.ee10.websocket.common.JettyWebSocketFrameHandler;
import org.eclipse.jetty.ee10.websocket.common.JettyWebSocketFrameHandlerFactory;
import org.eclipse.jetty.ee10.websocket.common.SessionTracker;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.util.DecoratedObjectFactory;
import org.eclipse.jetty.util.component.ContainerLifeCycle;
import org.eclipse.jetty.util.component.Graceful;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.ShutdownThread;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.WebSocketBehavior;
import org.eclipse.jetty.websocket.api.WebSocketContainer;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.api.WebSocketSessionListener;
import org.eclipse.jetty.websocket.client.internal.JettyClientUpgradeRequest;
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.core.Configuration;
import org.eclipse.jetty.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
@ -372,7 +371,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketPoli
}
/**
* The timeout to allow all remaining open Sessions to be closed gracefully using the close code {@link org.eclipse.jetty.ee10.websocket.api.StatusCode#SHUTDOWN}.
* The timeout to allow all remaining open Sessions to be closed gracefully using the close code {@link org.eclipse.jetty.websocket.api.StatusCode#SHUTDOWN}.
* @param stopTimeout the time in ms to wait for the graceful close, use a value less than or equal to 0 to not gracefully close.
*/
public void setStopTimeout(long stopTimeout)

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.client.impl;
package org.eclipse.jetty.websocket.client.internal;
import java.net.HttpCookie;
import java.net.URI;
@ -21,14 +21,14 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.eclipse.jetty.ee10.websocket.api.ExtensionConfig;
import org.eclipse.jetty.ee10.websocket.api.UpgradeRequest;
import org.eclipse.jetty.http.HttpField;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpScheme;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.util.UrlEncoded;
import org.eclipse.jetty.websocket.api.ExtensionConfig;
import org.eclipse.jetty.websocket.api.UpgradeRequest;
import org.eclipse.jetty.websocket.core.client.CoreClientUpgradeRequest;
import static java.nio.charset.StandardCharsets.UTF_8;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.client.impl;
package org.eclipse.jetty.websocket.client.internal;
import java.util.ArrayList;
import java.util.Collections;
@ -21,9 +21,9 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.jetty.client.Response;
import org.eclipse.jetty.ee10.websocket.api.ExtensionConfig;
import org.eclipse.jetty.ee10.websocket.api.UpgradeResponse;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.websocket.api.ExtensionConfig;
import org.eclipse.jetty.websocket.api.UpgradeResponse;
/**
* Representing the Jetty {@link org.eclipse.jetty.client.Response}

View File

@ -11,18 +11,18 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.client.impl;
package org.eclipse.jetty.websocket.client.internal;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.eclipse.jetty.client.Response;
import org.eclipse.jetty.ee10.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.ee10.websocket.common.JettyWebSocketFrameHandler;
import org.eclipse.jetty.ee10.websocket.common.JettyWebSocketFrameHandlerFactory;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandler;
import org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandlerFactory;
import org.eclipse.jetty.websocket.core.ExtensionConfig;
import org.eclipse.jetty.websocket.core.FrameHandler;
import org.eclipse.jetty.websocket.core.client.CoreClientUpgradeRequest;

View File

@ -23,10 +23,10 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.api.WebSocketAdapter;
import org.eclipse.jetty.ee10.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.ee10.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.WebSocketAdapter;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.core.OpCode;
/**

View File

@ -16,8 +16,8 @@ package examples;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.ee10.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.ee10.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient;
/**
* Example of a simple Echo Client.

View File

@ -16,12 +16,12 @@ package examples;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.api.StatusCode;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketClose;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.ee10.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
/**
* Basic Echo Client Socket

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.client;
package org.eclipse.jetty.websocket.client;
import java.util.concurrent.Executor;

View File

@ -11,16 +11,16 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.client;
package org.eclipse.jetty.websocket.client;
import java.net.URI;
import java.util.concurrent.CountDownLatch;
import java.util.stream.Stream;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.ee10.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.toolchain.test.jupiter.TestTrackerExtension;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.client;
package org.eclipse.jetty.websocket.client;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient;

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty.ee10.websocket</groupId>
<artifactId>jetty-ee10-websocket</artifactId>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-ee10-websocket-jetty-common</artifactId>
<name>EE10 :: Websocket :: Jetty Common</name>
<artifactId>jetty-websocket-jetty-common</artifactId>
<name>Core :: Websocket :: Jetty Common</name>
<properties>
<bundle-symbolic-name>${project.groupId}.common</bundle-symbolic-name>
@ -16,14 +16,6 @@
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
@{argLine} ${jetty.surefire.argLine} --add-reads org.eclipse.jetty.ee10.websocket.jetty.common=org.eclipse.jetty.io
</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
@ -34,7 +26,7 @@
osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)"
</Require-Capability>
<Provide-Capability>
osgi.serviceloader; osgi.serviceloader=org.eclipse.jetty.ee10.websocket.api.ExtensionConfig$Parser
osgi.serviceloader; osgi.serviceloader=org.eclipse.jetty.websocket.api.ExtensionConfig$Parser
</Provide-Capability>
</instructions>
</configuration>
@ -43,8 +35,8 @@
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.ee10.websocket</groupId>
<artifactId>jetty-ee10-websocket-jetty-api</artifactId>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>jetty-websocket-jetty-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>

View File

@ -11,16 +11,18 @@
// ========================================================================
//
module org.eclipse.jetty.ee10.websocket.jetty.common
import org.eclipse.jetty.websocket.common.ExtensionConfigParser;
module org.eclipse.jetty.websocket.common
{
requires org.eclipse.jetty.util;
requires org.slf4j;
requires transitive org.eclipse.jetty.websocket.core.common;
requires transitive org.eclipse.jetty.ee10.websocket.jetty.api;
requires transitive org.eclipse.jetty.websocket.api;
exports org.eclipse.jetty.ee10.websocket.common;
exports org.eclipse.jetty.websocket.common;
provides org.eclipse.jetty.ee10.websocket.api.ExtensionConfig.Parser with
org.eclipse.jetty.ee10.websocket.common.ExtensionConfigParser;
provides org.eclipse.jetty.websocket.api.ExtensionConfig.Parser with
ExtensionConfigParser;
}

View File

@ -11,11 +11,12 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import org.eclipse.jetty.websocket.api.ExtensionConfig.Parser;
import org.eclipse.jetty.websocket.core.ExtensionConfig;
public class ExtensionConfigParser implements org.eclipse.jetty.ee10.websocket.api.ExtensionConfig.Parser
public class ExtensionConfigParser implements Parser
{
/**
* Parse a single parameterized name.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.util.Map;
import java.util.Set;
@ -21,9 +21,8 @@ import org.eclipse.jetty.websocket.core.ExtensionConfig;
/**
* Represents an Extension Configuration, as seen during the connection Handshake process.
*/
public class JettyExtensionConfig implements org.eclipse.jetty.ee10.websocket.api.ExtensionConfig
public class JettyExtensionConfig implements org.eclipse.jetty.websocket.api.ExtensionConfig
{
private final ExtensionConfig config;
/**

View File

@ -11,13 +11,13 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.nio.ByteBuffer;
import org.eclipse.jetty.websocket.core.Frame;
public class JettyWebSocketFrame implements org.eclipse.jetty.ee10.websocket.api.Frame
public class JettyWebSocketFrame implements org.eclipse.jetty.websocket.api.Frame
{
private final Frame frame;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.lang.invoke.MethodHandle;
import java.nio.ByteBuffer;
@ -19,14 +19,14 @@ import java.nio.channels.ClosedChannelException;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
import org.eclipse.jetty.ee10.websocket.api.BatchMode;
import org.eclipse.jetty.ee10.websocket.api.UpgradeRequest;
import org.eclipse.jetty.ee10.websocket.api.UpgradeResponse;
import org.eclipse.jetty.ee10.websocket.api.WebSocketContainer;
import org.eclipse.jetty.ee10.websocket.api.WriteCallback;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.thread.AutoLock;
import org.eclipse.jetty.websocket.api.BatchMode;
import org.eclipse.jetty.websocket.api.UpgradeRequest;
import org.eclipse.jetty.websocket.api.UpgradeResponse;
import org.eclipse.jetty.websocket.api.WebSocketContainer;
import org.eclipse.jetty.websocket.api.WriteCallback;
import org.eclipse.jetty.websocket.core.CloseStatus;
import org.eclipse.jetty.websocket.core.Configuration;
import org.eclipse.jetty.websocket.core.CoreSession;
@ -509,28 +509,25 @@ public class JettyWebSocketFrameHandler implements FrameHandler
public static Throwable convertCause(Throwable cause)
{
if (cause instanceof MessageTooLargeException)
return new org.eclipse.jetty.ee10.websocket.api.exceptions.MessageTooLargeException(cause.getMessage(), cause);
return new org.eclipse.jetty.websocket.api.exceptions.MessageTooLargeException(cause.getMessage(), cause);
if (cause instanceof ProtocolException)
return new org.eclipse.jetty.ee10.websocket.api.exceptions.ProtocolException(cause.getMessage(), cause);
return new org.eclipse.jetty.websocket.api.exceptions.ProtocolException(cause.getMessage(), cause);
if (cause instanceof BadPayloadException)
return new org.eclipse.jetty.ee10.websocket.api.exceptions.BadPayloadException(cause.getMessage(), cause);
return new org.eclipse.jetty.websocket.api.exceptions.BadPayloadException(cause.getMessage(), cause);
if (cause instanceof CloseException)
return new org.eclipse.jetty.ee10.websocket.api.exceptions.CloseException(((CloseException)cause).getStatusCode(), cause.getMessage(), cause);
return new org.eclipse.jetty.websocket.api.exceptions.CloseException(((CloseException)cause).getStatusCode(), cause.getMessage(), cause);
if (cause instanceof WebSocketTimeoutException)
return new org.eclipse.jetty.ee10.websocket.api.exceptions.WebSocketTimeoutException(cause.getMessage(), cause);
return new org.eclipse.jetty.websocket.api.exceptions.WebSocketTimeoutException(cause.getMessage(), cause);
if (cause instanceof InvalidSignatureException)
return new org.eclipse.jetty.ee10.websocket.api.exceptions.InvalidWebSocketException(cause.getMessage(), cause);
return new org.eclipse.jetty.websocket.api.exceptions.InvalidWebSocketException(cause.getMessage(), cause);
if (cause instanceof UpgradeException)
{
UpgradeException ue = (UpgradeException)cause;
return new org.eclipse.jetty.ee10.websocket.api.exceptions.UpgradeException(ue.getRequestURI(), ue.getResponseStatusCode(), cause);
}
if (cause instanceof UpgradeException ue)
return new org.eclipse.jetty.websocket.api.exceptions.UpgradeException(ue.getRequestURI(), ue.getResponseStatusCode(), cause);
return cause;
}

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.io.IOException;
import java.io.InputStream;
@ -29,22 +29,22 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executor;
import org.eclipse.jetty.ee10.websocket.api.BatchMode;
import org.eclipse.jetty.ee10.websocket.api.Frame;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.api.WebSocketConnectionListener;
import org.eclipse.jetty.ee10.websocket.api.WebSocketContainer;
import org.eclipse.jetty.ee10.websocket.api.WebSocketFrameListener;
import org.eclipse.jetty.ee10.websocket.api.WebSocketListener;
import org.eclipse.jetty.ee10.websocket.api.WebSocketPartialListener;
import org.eclipse.jetty.ee10.websocket.api.WebSocketPingPongListener;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketClose;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketError;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketFrame;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.ee10.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.util.component.ContainerLifeCycle;
import org.eclipse.jetty.websocket.api.BatchMode;
import org.eclipse.jetty.websocket.api.Frame;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.WebSocketConnectionListener;
import org.eclipse.jetty.websocket.api.WebSocketContainer;
import org.eclipse.jetty.websocket.api.WebSocketFrameListener;
import org.eclipse.jetty.websocket.api.WebSocketListener;
import org.eclipse.jetty.websocket.api.WebSocketPartialListener;
import org.eclipse.jetty.websocket.api.WebSocketPingPongListener;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketError;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketFrame;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.websocket.core.CoreSession;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
import org.eclipse.jetty.websocket.core.exception.InvalidSignatureException;
@ -67,13 +67,13 @@ import org.eclipse.jetty.websocket.core.util.ReflectUtils;
* Will create a {@link org.eclipse.jetty.websocket.core.FrameHandler} suitable for use with classes/objects that:
* </p>
* <ul>
* <li>Is &#64;{@link org.eclipse.jetty.ee10.websocket.api.annotations.WebSocket} annotated</li>
* <li>Extends {@link org.eclipse.jetty.ee10.websocket.api.WebSocketAdapter}</li>
* <li>Implements {@link org.eclipse.jetty.ee10.websocket.api.WebSocketListener}</li>
* <li>Implements {@link org.eclipse.jetty.ee10.websocket.api.WebSocketConnectionListener}</li>
* <li>Implements {@link org.eclipse.jetty.ee10.websocket.api.WebSocketPartialListener}</li>
* <li>Implements {@link org.eclipse.jetty.ee10.websocket.api.WebSocketPingPongListener}</li>
* <li>Implements {@link org.eclipse.jetty.ee10.websocket.api.WebSocketFrameListener}</li>
* <li>Is &#64;{@link org.eclipse.jetty.websocket.api.annotations.WebSocket} annotated</li>
* <li>Extends {@link org.eclipse.jetty.websocket.api.WebSocketAdapter}</li>
* <li>Implements {@link org.eclipse.jetty.websocket.api.WebSocketListener}</li>
* <li>Implements {@link org.eclipse.jetty.websocket.api.WebSocketConnectionListener}</li>
* <li>Implements {@link org.eclipse.jetty.websocket.api.WebSocketPartialListener}</li>
* <li>Implements {@link org.eclipse.jetty.websocket.api.WebSocketPingPongListener}</li>
* <li>Implements {@link org.eclipse.jetty.websocket.api.WebSocketFrameListener}</li>
* </ul>
*/
public class JettyWebSocketFrameHandlerFactory extends ContainerLifeCycle

View File

@ -11,12 +11,12 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.lang.invoke.MethodHandle;
import org.eclipse.jetty.ee10.websocket.api.BatchMode;
import org.eclipse.jetty.ee10.websocket.api.exceptions.InvalidWebSocketException;
import org.eclipse.jetty.websocket.api.BatchMode;
import org.eclipse.jetty.websocket.api.exceptions.InvalidWebSocketException;
import org.eclipse.jetty.websocket.core.Configuration;
import org.eclipse.jetty.websocket.core.messages.MessageSink;

View File

@ -11,18 +11,18 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.io.IOException;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.util.Objects;
import org.eclipse.jetty.ee10.websocket.api.BatchMode;
import org.eclipse.jetty.ee10.websocket.api.WriteCallback;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.FutureCallback;
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.OpCode;
@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
import static java.nio.charset.StandardCharsets.UTF_8;
public class JettyWebSocketRemoteEndpoint implements org.eclipse.jetty.ee10.websocket.api.RemoteEndpoint
public class JettyWebSocketRemoteEndpoint implements org.eclipse.jetty.websocket.api.RemoteEndpoint
{
private static final Logger LOG = LoggerFactory.getLogger(JettyWebSocketRemoteEndpoint.class);

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.io.IOException;
import java.util.Collection;
@ -20,13 +20,13 @@ import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.api.StatusCode;
import org.eclipse.jetty.ee10.websocket.api.WebSocketSessionListener;
import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.component.Graceful;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.WebSocketSessionListener;
public class SessionTracker extends AbstractLifeCycle implements WebSocketSessionListener, Graceful, Dumpable
{

View File

@ -11,31 +11,28 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.io.IOException;
import java.net.SocketAddress;
import java.time.Duration;
import java.util.Objects;
import org.eclipse.jetty.ee10.websocket.api.CloseStatus;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.api.StatusCode;
import org.eclipse.jetty.ee10.websocket.api.SuspendToken;
import org.eclipse.jetty.ee10.websocket.api.UpgradeRequest;
import org.eclipse.jetty.ee10.websocket.api.UpgradeResponse;
import org.eclipse.jetty.ee10.websocket.api.WebSocketBehavior;
import org.eclipse.jetty.ee10.websocket.api.WebSocketContainer;
import org.eclipse.jetty.ee10.websocket.api.WriteCallback;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.websocket.api.CloseStatus;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.SuspendToken;
import org.eclipse.jetty.websocket.api.UpgradeRequest;
import org.eclipse.jetty.websocket.api.UpgradeResponse;
import org.eclipse.jetty.websocket.api.WebSocketBehavior;
import org.eclipse.jetty.websocket.api.WebSocketContainer;
import org.eclipse.jetty.websocket.api.WriteCallback;
import org.eclipse.jetty.websocket.core.CoreSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class WebSocketSession implements Session, SuspendToken, Dumpable
{
private static final Logger LOG = LoggerFactory.getLogger(WebSocketSession.class);
private final CoreSession coreSession;
private final JettyWebSocketFrameHandler frameHandler;
private final JettyWebSocketRemoteEndpoint remoteEndpoint;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.util.ArrayList;
import java.util.Collection;
@ -19,11 +19,11 @@ import java.util.List;
import java.util.concurrent.Executor;
import java.util.function.Consumer;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.api.WebSocketContainer;
import org.eclipse.jetty.ee10.websocket.api.WebSocketSessionListener;
import org.eclipse.jetty.util.component.ContainerLifeCycle;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.WebSocketContainer;
import org.eclipse.jetty.websocket.api.WebSocketSessionListener;
public class DummyContainer extends ContainerLifeCycle implements WebSocketContainer
{

View File

@ -11,27 +11,27 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.nio.ByteBuffer;
import org.eclipse.jetty.ee10.websocket.api.Frame;
import org.eclipse.jetty.ee10.websocket.api.RemoteEndpoint;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.api.WebSocketFrameListener;
import org.eclipse.jetty.ee10.websocket.api.WebSocketListener;
import org.eclipse.jetty.ee10.websocket.api.WebSocketPartialListener;
import org.eclipse.jetty.ee10.websocket.api.WebSocketPingPongListener;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketClose;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketError;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketFrame;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.ee10.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.websocket.api.Frame;
import org.eclipse.jetty.websocket.api.RemoteEndpoint;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.WebSocketFrameListener;
import org.eclipse.jetty.websocket.api.WebSocketListener;
import org.eclipse.jetty.websocket.api.WebSocketPartialListener;
import org.eclipse.jetty.websocket.api.WebSocketPingPongListener;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketError;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketFrame;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.websocket.core.CloseStatus;
import org.eclipse.jetty.websocket.core.util.TextUtils;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.util.Iterator;
import java.util.NoSuchElementException;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.io.IOException;
import java.io.Reader;
@ -20,14 +20,14 @@ import java.time.Duration;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.api.StatusCode;
import org.eclipse.jetty.ee10.websocket.api.WebSocketConnectionListener;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.ee10.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.WebSocketConnectionListener;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.websocket.core.Behavior;
import org.eclipse.jetty.websocket.core.CloseStatus;
import org.eclipse.jetty.websocket.core.CoreSession;

View File

@ -11,9 +11,9 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import org.eclipse.jetty.ee10.websocket.api.exceptions.InvalidWebSocketException;
import org.eclipse.jetty.websocket.api.exceptions.InvalidWebSocketException;
import org.eclipse.jetty.websocket.core.WebSocketComponents;
import org.eclipse.jetty.websocket.core.exception.DuplicateAnnotationException;
import org.eclipse.jetty.websocket.core.exception.InvalidSignatureException;
@ -329,9 +329,6 @@ public class LocalEndpointMetadataTest
assertThat(classId + ".pongHandle", metadata.getPongHandle(), nullValue());
}
/**
* Test Case for socket using {@link org.eclipse.jetty.ee10.websocket.api.WebSocketListener}
*/
@Test
public void testListenerBasicSocket()
{
@ -354,9 +351,6 @@ public class LocalEndpointMetadataTest
assertThat(classId + ".pongHandle", metadata.getPongHandle(), nullValue());
}
/**
* Test Case for socket using {@link org.eclipse.jetty.ee10.websocket.api.WebSocketFrameListener}
*/
@Test
public void testListenerFrameSocket() throws Exception
{

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.io.IOException;
import java.nio.ByteBuffer;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.nio.ByteBuffer;
import java.util.Arrays;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common;
package org.eclipse.jetty.websocket.common;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;

View File

@ -11,11 +11,11 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common.endpoints.adapters;
package org.eclipse.jetty.websocket.common.endpoints.adapters;
import java.io.IOException;
import org.eclipse.jetty.ee10.websocket.api.WebSocketAdapter;
import org.eclipse.jetty.websocket.api.WebSocketAdapter;
/**
* Example EchoSocket using Adapter.

View File

@ -11,11 +11,11 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common.endpoints.adapters;
package org.eclipse.jetty.websocket.common.endpoints.adapters;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.ee10.websocket.api.annotations.WebSocket;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage;
import org.eclipse.jetty.websocket.api.annotations.WebSocket;
/**
* Example EchoSocket using Annotations.

View File

@ -11,10 +11,10 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common.endpoints.adapters;
package org.eclipse.jetty.websocket.common.endpoints.adapters;
import org.eclipse.jetty.ee10.websocket.api.Session;
import org.eclipse.jetty.ee10.websocket.api.WebSocketListener;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.WebSocketListener;
/**
* Example EchoSocket using Listener.

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common.invoke;
package org.eclipse.jetty.websocket.common.invoke;
import java.io.File;
import java.lang.invoke.MethodHandle;

View File

@ -11,7 +11,7 @@
// ========================================================================
//
package org.eclipse.jetty.ee10.websocket.common.invoke;
package org.eclipse.jetty.websocket.common.invoke;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

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