Issue #9396 - fixes to resolve WebSocket JPMS warnings
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
d3e88a95fe
commit
b0923b2fd9
|
@ -13,11 +13,11 @@
|
|||
|
||||
module org.eclipse.jetty.websocket.server
|
||||
{
|
||||
requires org.eclipse.jetty.server;
|
||||
requires org.eclipse.jetty.websocket.core.server;
|
||||
requires org.eclipse.jetty.websocket.common;
|
||||
requires org.slf4j;
|
||||
|
||||
requires transitive org.eclipse.jetty.server;
|
||||
requires transitive org.eclipse.jetty.websocket.api;
|
||||
|
||||
exports org.eclipse.jetty.websocket.server;
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.eclipse.jetty.websocket.api.Session;
|
|||
import org.eclipse.jetty.websocket.api.WebSocketContainer;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketSessionListener;
|
||||
import org.eclipse.jetty.websocket.common.SessionTracker;
|
||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
|
||||
import org.eclipse.jetty.websocket.core.server.FrameHandlerFactory;
|
||||
import org.eclipse.jetty.websocket.core.server.WebSocketMappings;
|
||||
|
@ -58,7 +57,7 @@ public class ServerWebSocketContainer extends ContainerLifeCycle implements WebS
|
|||
private final FrameHandlerFactory factory;
|
||||
private InvocationType invocationType = InvocationType.BLOCKING;
|
||||
|
||||
public ServerWebSocketContainer(WebSocketMappings mappings)
|
||||
ServerWebSocketContainer(WebSocketMappings mappings)
|
||||
{
|
||||
this.mappings = mappings;
|
||||
this.factory = new ServerFrameHandlerFactory(this, mappings.getWebSocketComponents());
|
||||
|
@ -66,15 +65,10 @@ public class ServerWebSocketContainer extends ContainerLifeCycle implements WebS
|
|||
addBean(sessionTracker);
|
||||
}
|
||||
|
||||
public WebSocketComponents getWebSocketComponents()
|
||||
{
|
||||
return mappings.getWebSocketComponents();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Executor getExecutor()
|
||||
{
|
||||
return getWebSocketComponents().getExecutor();
|
||||
return mappings.getWebSocketComponents().getExecutor();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -84,16 +84,20 @@ public class WebSocketUpgradeHandler extends Handler.Wrapper
|
|||
*/
|
||||
public static WebSocketUpgradeHandler from(Server server, ContextHandler context)
|
||||
{
|
||||
WebSocketUpgradeHandler wsHandler = new WebSocketUpgradeHandler(WebSocketServerComponents.ensureWebSocketComponents(server, context));
|
||||
context.getContext().setAttribute(WebSocketContainer.class.getName(), wsHandler.container);
|
||||
WebSocketComponents components = WebSocketServerComponents.ensureWebSocketComponents(server, context);
|
||||
WebSocketMappings mappings = new WebSocketMappings(components);
|
||||
ServerWebSocketContainer container = new ServerWebSocketContainer(mappings);
|
||||
|
||||
WebSocketUpgradeHandler wsHandler = new WebSocketUpgradeHandler(container);
|
||||
context.getContext().setAttribute(WebSocketContainer.class.getName(), wsHandler._container);
|
||||
return wsHandler;
|
||||
}
|
||||
|
||||
private final ServerWebSocketContainer container;
|
||||
private final ServerWebSocketContainer _container;
|
||||
|
||||
private WebSocketUpgradeHandler(WebSocketComponents components)
|
||||
private WebSocketUpgradeHandler(ServerWebSocketContainer container)
|
||||
{
|
||||
this.container = new ServerWebSocketContainer(new WebSocketMappings(components));
|
||||
_container = container;
|
||||
addBean(container);
|
||||
}
|
||||
|
||||
|
@ -106,14 +110,14 @@ public class WebSocketUpgradeHandler extends Handler.Wrapper
|
|||
*/
|
||||
public WebSocketUpgradeHandler configure(Consumer<ServerWebSocketContainer> configurator)
|
||||
{
|
||||
configurator.accept(container);
|
||||
configurator.accept(_container);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Request request, Response response, Callback callback) throws Exception
|
||||
{
|
||||
if (container.handle(request, response, callback))
|
||||
if (_container.handle(request, response, callback))
|
||||
return true;
|
||||
return super.handle(request, response, callback);
|
||||
}
|
||||
|
@ -125,6 +129,6 @@ public class WebSocketUpgradeHandler extends Handler.Wrapper
|
|||
return InvocationType.BLOCKING;
|
||||
Handler handler = getHandler();
|
||||
InvocationType handlerInvocationType = handler == null ? InvocationType.NON_BLOCKING : handler.getInvocationType();
|
||||
return Invocable.combine(handlerInvocationType, container.getInvocationType());
|
||||
return Invocable.combine(handlerInvocationType, _container.getInvocationType());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,9 @@ import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
|
|||
import org.eclipse.jetty.websocket.client.WebSocketClient;
|
||||
import org.eclipse.jetty.websocket.core.AbstractExtension;
|
||||
import org.eclipse.jetty.websocket.core.Frame;
|
||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||
import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient;
|
||||
import org.eclipse.jetty.websocket.core.server.WebSocketServerComponents;
|
||||
import org.eclipse.jetty.websocket.server.WebSocketUpgradeHandler;
|
||||
import org.eclipse.jetty.websocket.tests.util.FutureCallback;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
|
@ -66,7 +68,8 @@ public class MaxOutgoingFramesTest
|
|||
wsHandler.configure(container ->
|
||||
{
|
||||
container.addMapping("/", (rq, rs, cb) -> serverSocket);
|
||||
container.getWebSocketComponents().getExtensionRegistry().register(BlockingOutgoingExtension.class.getName(), BlockingOutgoingExtension.class);
|
||||
WebSocketComponents components = WebSocketServerComponents.getWebSocketComponents(context);
|
||||
components.getExtensionRegistry().register(BlockingOutgoingExtension.class.getName(), BlockingOutgoingExtension.class);
|
||||
});
|
||||
|
||||
server.setHandler(context);
|
||||
|
|
|
@ -16,6 +16,4 @@ module org.eclipse.jetty.ee10.websocket.jetty.client
|
|||
requires org.eclipse.jetty.websocket.client;
|
||||
|
||||
requires static org.eclipse.jetty.ee10.webapp;
|
||||
|
||||
exports org.eclipse.jetty.ee10.websocket.client.config;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue