jetty websocket modules should not transitively export websocket-core
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
a0626adad5
commit
ac69c53077
|
@ -704,9 +704,18 @@ public abstract class JavaxWebSocketFrameHandlerFactory
|
|||
}
|
||||
}
|
||||
|
||||
private MethodHandles.Lookup getMethodHandleLookup(Class<?> endpointClass)
|
||||
private MethodHandles.Lookup getMethodHandleLookup(Class<?> endpointClass) throws InvalidWebSocketException
|
||||
{
|
||||
return MethodHandles.lookup();
|
||||
MethodHandles.Lookup lookup;
|
||||
try
|
||||
{
|
||||
lookup = MethodHandles.privateLookupIn(endpointClass, MethodHandles.lookup());
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
throw new InvalidWebSocketException("Unable to obtain MethodHandle lookup for " + endpointClass, e);
|
||||
}
|
||||
return lookup;
|
||||
}
|
||||
|
||||
private static class DecodedArgs
|
||||
|
|
|
@ -16,15 +16,12 @@
|
|||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.websocket.common;
|
||||
package org.eclipse.jetty.websocket.api;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.eclipse.jetty.websocket.api.Session;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketSessionListener;
|
||||
|
||||
/**
|
||||
* Generic interface to the Container (server or client)
|
||||
*/
|
|
@ -21,6 +21,7 @@ module org.eclipse.jetty.websocket.jetty.client
|
|||
exports org.eclipse.jetty.websocket.client;
|
||||
|
||||
requires transitive org.eclipse.jetty.client;
|
||||
requires transitive org.eclipse.jetty.websocket.jetty.api;
|
||||
requires org.eclipse.jetty.websocket.core;
|
||||
requires transitive org.eclipse.jetty.websocket.jetty.common;
|
||||
requires org.eclipse.jetty.websocket.jetty.common;
|
||||
}
|
||||
|
|
|
@ -45,13 +45,13 @@ import org.eclipse.jetty.util.thread.ShutdownThread;
|
|||
import org.eclipse.jetty.websocket.api.Session;
|
||||
import org.eclipse.jetty.websocket.api.UpgradeRequest;
|
||||
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.impl.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.common.WebSocketContainer;
|
||||
import org.eclipse.jetty.websocket.core.Configuration;
|
||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||
import org.eclipse.jetty.websocket.core.client.UpgradeListener;
|
||||
|
@ -131,7 +131,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketPoli
|
|||
coreClient.addBean(listener);
|
||||
}
|
||||
|
||||
JettyClientUpgradeRequest upgradeRequest = new JettyClientUpgradeRequest(this, coreClient, request, toUri, websocket);
|
||||
JettyClientUpgradeRequest upgradeRequest = new JettyClientUpgradeRequest(coreClient, request, toUri, frameHandlerFactory, websocket);
|
||||
if (upgradeListener != null)
|
||||
{
|
||||
upgradeRequest.addListener(new UpgradeListener()
|
||||
|
@ -353,11 +353,6 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketPoli
|
|||
return sessionTracker.getSessions();
|
||||
}
|
||||
|
||||
public JettyWebSocketFrameHandler newFrameHandler(Object websocketPojo)
|
||||
{
|
||||
return frameHandlerFactory.newJettyFrameHandler(websocketPojo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the {@link SslContextFactory} that manages TLS encryption
|
||||
*/
|
||||
|
|
|
@ -29,8 +29,8 @@ import org.eclipse.jetty.http.HttpHeader;
|
|||
import org.eclipse.jetty.http.HttpVersion;
|
||||
import org.eclipse.jetty.io.EndPoint;
|
||||
import org.eclipse.jetty.websocket.api.UpgradeRequest;
|
||||
import org.eclipse.jetty.websocket.client.WebSocketClient;
|
||||
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.ClientUpgradeRequest;
|
||||
|
@ -38,21 +38,19 @@ import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient;
|
|||
|
||||
public class JettyClientUpgradeRequest extends ClientUpgradeRequest
|
||||
{
|
||||
private final WebSocketClient containerContext;
|
||||
private final DelegatedJettyClientUpgradeRequest handshakeRequest;
|
||||
private final JettyWebSocketFrameHandler frameHandler;
|
||||
|
||||
public JettyClientUpgradeRequest(WebSocketClient clientContainer, WebSocketCoreClient coreClient, UpgradeRequest request,
|
||||
URI requestURI, Object websocketPojo)
|
||||
public JettyClientUpgradeRequest(WebSocketCoreClient coreClient, UpgradeRequest request, URI requestURI, JettyWebSocketFrameHandlerFactory frameHandlerFactory,
|
||||
Object websocketPojo)
|
||||
{
|
||||
super(coreClient, requestURI);
|
||||
this.containerContext = clientContainer;
|
||||
|
||||
if (request != null)
|
||||
{
|
||||
// Copy request details into actual request
|
||||
HttpFields fields = getHeaders();
|
||||
request.getHeaders().forEach((name, values) -> fields.put(name, values));
|
||||
request.getHeaders().forEach(fields::put);
|
||||
|
||||
// Copy manually created Cookies into place
|
||||
List<HttpCookie> cookies = request.getCookies();
|
||||
|
@ -84,7 +82,7 @@ public class JettyClientUpgradeRequest extends ClientUpgradeRequest
|
|||
}
|
||||
|
||||
handshakeRequest = new DelegatedJettyClientUpgradeRequest(this);
|
||||
frameHandler = containerContext.newFrameHandler(websocketPojo);
|
||||
frameHandler = frameHandlerFactory.newJettyFrameHandler(websocketPojo);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,8 +24,8 @@ module org.eclipse.jetty.websocket.jetty.common
|
|||
exports org.eclipse.jetty.websocket.common;
|
||||
|
||||
requires transitive org.eclipse.jetty.websocket.core;
|
||||
requires transitive org.eclipse.jetty.websocket.util;
|
||||
requires transitive org.eclipse.jetty.websocket.jetty.api;
|
||||
requires transitive org.eclipse.jetty.websocket.util;
|
||||
|
||||
provides ExtensionConfig.Parser with ExtensionConfigParser;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.jetty.util.log.Logger;
|
|||
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;
|
||||
|
|
|
@ -39,6 +39,7 @@ 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;
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.function.Consumer;
|
|||
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
|
||||
|
|
|
@ -28,8 +28,9 @@ module org.eclipse.jetty.websocket.jetty.server
|
|||
exports org.eclipse.jetty.websocket.server.config;
|
||||
|
||||
requires jetty.servlet.api;
|
||||
requires org.eclipse.jetty.websocket.jetty.common;
|
||||
requires transitive org.eclipse.jetty.webapp;
|
||||
requires transitive org.eclipse.jetty.websocket.jetty.common;
|
||||
requires transitive org.eclipse.jetty.websocket.jetty.api;
|
||||
requires transitive org.eclipse.jetty.websocket.servlet;
|
||||
|
||||
// Only required if using JMX.
|
||||
|
|
|
@ -34,10 +34,10 @@ import org.eclipse.jetty.util.log.Log;
|
|||
import org.eclipse.jetty.util.log.Logger;
|
||||
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.common.SessionTracker;
|
||||
import org.eclipse.jetty.websocket.common.WebSocketContainer;
|
||||
import org.eclipse.jetty.websocket.core.Configuration;
|
||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||
import org.eclipse.jetty.websocket.core.exception.WebSocketException;
|
||||
|
|
|
@ -23,9 +23,9 @@ import javax.servlet.ServletContext;
|
|||
import org.eclipse.jetty.server.handler.ContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.util.component.LifeCycle;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketContainer;
|
||||
import org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandler;
|
||||
import org.eclipse.jetty.websocket.common.JettyWebSocketFrameHandlerFactory;
|
||||
import org.eclipse.jetty.websocket.common.WebSocketContainer;
|
||||
import org.eclipse.jetty.websocket.core.FrameHandler;
|
||||
import org.eclipse.jetty.websocket.servlet.FrameHandlerFactory;
|
||||
import org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest;
|
||||
|
|
|
@ -22,8 +22,8 @@ import java.util.Collection;
|
|||
|
||||
import org.eclipse.jetty.websocket.api.Session;
|
||||
import org.eclipse.jetty.websocket.api.StatusCode;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketContainer;
|
||||
import org.eclipse.jetty.websocket.api.WriteCallback;
|
||||
import org.eclipse.jetty.websocket.common.WebSocketContainer;
|
||||
|
||||
/**
|
||||
* On Message, return container information
|
||||
|
|
|
@ -21,7 +21,7 @@ package org.eclipse.jetty.websocket.tests.server;
|
|||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.eclipse.jetty.websocket.common.WebSocketContainer;
|
||||
import org.eclipse.jetty.websocket.api.WebSocketContainer;
|
||||
import org.eclipse.jetty.websocket.server.JettyServerUpgradeRequest;
|
||||
import org.eclipse.jetty.websocket.server.JettyServerUpgradeResponse;
|
||||
import org.eclipse.jetty.websocket.server.JettyWebSocketCreator;
|
||||
|
|
Loading…
Reference in New Issue