Deprecate JettyWebSocketClient in favor of StandardWebSocketClient

JettyWebSocketClient only supported on Jetty 11, to be phased out.

Closes gh-29576
This commit is contained in:
Juergen Hoeller 2022-11-25 17:06:15 +01:00
parent 45d45c2989
commit 9c7b471634
5 changed files with 12 additions and 2 deletions

View File

@ -39,6 +39,7 @@ import org.springframework.web.reactive.socket.adapter.JettyWebSocketSession;
/** /**
* A {@link WebSocketClient} implementation for use with Jetty * A {@link WebSocketClient} implementation for use with Jetty
* {@link org.eclipse.jetty.websocket.client.WebSocketClient}. * {@link org.eclipse.jetty.websocket.client.WebSocketClient}.
* Only supported on Jetty 11, superseded by {@link StandardWebSocketClient}.
* *
* <p><strong>Note: </strong> the Jetty {@code WebSocketClient} requires * <p><strong>Note: </strong> the Jetty {@code WebSocketClient} requires
* lifecycle management and must be started and stopped. This is automatically * lifecycle management and must be started and stopped. This is automatically
@ -49,7 +50,9 @@ import org.springframework.web.reactive.socket.adapter.JettyWebSocketSession;
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 5.0 * @since 5.0
* @deprecated as of 6.0.3, in favor of {@link StandardWebSocketClient}
*/ */
@Deprecated(since = "6.0.3", forRemoval = true)
public class JettyWebSocketClient implements WebSocketClient, Lifecycle { public class JettyWebSocketClient implements WebSocketClient, Lifecycle {
private static final Log logger = LogFactory.getLog(JettyWebSocketClient.class); private static final Log logger = LogFactory.getLog(JettyWebSocketClient.class);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -91,6 +91,7 @@ abstract class AbstractWebSocketIntegrationTests {
static Stream<Object[]> arguments() throws IOException { static Stream<Object[]> arguments() throws IOException {
@SuppressWarnings("removal")
WebSocketClient[] clients = new WebSocketClient[] { WebSocketClient[] clients = new WebSocketClient[] {
new TomcatWebSocketClient(), new TomcatWebSocketClient(),
new JettyWebSocketClient(), new JettyWebSocketClient(),

View File

@ -45,7 +45,8 @@ import org.springframework.web.socket.client.AbstractWebSocketClient;
/** /**
* Initiates WebSocket requests to a WebSocket server programmatically * Initiates WebSocket requests to a WebSocket server programmatically
* through the Jetty WebSocket API. * through the Jetty WebSocket API. Only supported on Jetty 11, superseded by
* {@link org.springframework.web.socket.client.standard.StandardWebSocketClient}.
* *
* <p>As of 4.1 this class implements {@link Lifecycle} rather than * <p>As of 4.1 this class implements {@link Lifecycle} rather than
* {@link org.springframework.context.SmartLifecycle}. Use * {@link org.springframework.context.SmartLifecycle}. Use
@ -55,7 +56,10 @@ import org.springframework.web.socket.client.AbstractWebSocketClient;
* @author Rossen Stoyanchev * @author Rossen Stoyanchev
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 4.0 * @since 4.0
* @deprecated as of 6.0.3, in favor of
* {@link org.springframework.web.socket.client.standard.StandardWebSocketClient}
*/ */
@Deprecated(since = "6.0.3", forRemoval = true)
public class JettyWebSocketClient extends AbstractWebSocketClient implements Lifecycle { public class JettyWebSocketClient extends AbstractWebSocketClient implements Lifecycle {
private final org.eclipse.jetty.websocket.client.WebSocketClient client; private final org.eclipse.jetty.websocket.client.WebSocketClient client;

View File

@ -65,6 +65,7 @@ public abstract class AbstractWebSocketIntegrationTests {
upgradeStrategyConfigTypes.put(UndertowTestServer.class, UndertowUpgradeStrategyConfig.class); upgradeStrategyConfigTypes.put(UndertowTestServer.class, UndertowUpgradeStrategyConfig.class);
} }
@SuppressWarnings("removal")
static Stream<Arguments> argumentsFactory() { static Stream<Arguments> argumentsFactory() {
return Stream.of( return Stream.of(
arguments(named("Jetty", new JettyWebSocketTestServer()), named("Jetty", new JettyWebSocketClient())), arguments(named("Jetty", new JettyWebSocketTestServer()), named("Jetty", new JettyWebSocketClient())),

View File

@ -42,6 +42,7 @@ class JettySockJsIntegrationTests extends AbstractSockJsIntegrationTests {
return new JettyWebSocketTestServer(); return new JettyWebSocketTestServer();
} }
@SuppressWarnings("removal")
@Override @Override
protected Transport createWebSocketTransport() { protected Transport createWebSocketTransport() {
return new WebSocketTransport(new JettyWebSocketClient()); return new WebSocketTransport(new JettyWebSocketClient());