don't allow custom CoreClients to be supplied to JavaxClientContainer
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
c40a303e2c
commit
0b41386c0d
|
@ -40,6 +40,7 @@ import org.eclipse.jetty.client.HttpClient;
|
|||
import org.eclipse.jetty.io.ByteBufferPool;
|
||||
import org.eclipse.jetty.util.DecoratedObjectFactory;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.websocket.core.WebSocketComponents;
|
||||
import org.eclipse.jetty.websocket.core.WebSocketExtensionRegistry;
|
||||
import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient;
|
||||
import org.eclipse.jetty.websocket.javax.common.ConfiguredEndpoint;
|
||||
|
@ -64,34 +65,23 @@ public class JavaxWebSocketClientContainer extends JavaxWebSocketContainer imple
|
|||
|
||||
public JavaxWebSocketClientContainer()
|
||||
{
|
||||
this(() -> {
|
||||
WebSocketCoreClient coreClient = new WebSocketCoreClient();
|
||||
coreClient.getHttpClient().setName("Javax-WebSocketClient@" + Integer.toHexString(coreClient.getHttpClient().hashCode()));
|
||||
return coreClient;
|
||||
});
|
||||
this(new WebSocketComponents(), null, null);
|
||||
}
|
||||
|
||||
public JavaxWebSocketClientContainer(Supplier<WebSocketCoreClient> coreClientFactory)
|
||||
public JavaxWebSocketClientContainer(WebSocketComponents components, HttpClient httpClient, Executor executor)
|
||||
{
|
||||
this((WebSocketCoreClient)null);
|
||||
this.coreClientFactory = coreClientFactory;
|
||||
this.addBean(coreClientFactory);
|
||||
}
|
||||
|
||||
public JavaxWebSocketClientContainer(WebSocketCoreClient coreClient)
|
||||
{
|
||||
super();
|
||||
|
||||
if (coreClient != null)
|
||||
{
|
||||
coreClient.setCustomizer(defaultCustomizer);
|
||||
this.coreClient = coreClient;
|
||||
this.addBean(coreClient);
|
||||
}
|
||||
|
||||
this.objectFactory = new DecoratedObjectFactory();
|
||||
this.extensionRegistry = new WebSocketExtensionRegistry();
|
||||
this.objectFactory = components.getObjectFactory();
|
||||
this.extensionRegistry = components.getExtensionRegistry();
|
||||
this.frameHandlerFactory = new JavaxWebSocketClientFrameHandlerFactory(this);
|
||||
|
||||
coreClientFactory = () ->
|
||||
{
|
||||
WebSocketCoreClient coreClient = new WebSocketCoreClient(httpClient, defaultCustomizer);
|
||||
coreClient.getHttpClient().setName("Javax-WebSocketClient@" + Integer.toHexString(coreClient.getHttpClient().hashCode()));
|
||||
if (executor != null && httpClient == null)
|
||||
coreClient.getHttpClient().setExecutor(executor);
|
||||
return coreClient;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,12 +106,7 @@ public class JavaxWebSocketClientContainer extends JavaxWebSocketContainer imple
|
|||
if (coreClient == null)
|
||||
{
|
||||
coreClient = coreClientFactory.get();
|
||||
if (coreClient.isRunning())
|
||||
addBean(coreClient,false);
|
||||
else
|
||||
addManaged(coreClient);
|
||||
|
||||
coreClient.setCustomizer(defaultCustomizer);
|
||||
}
|
||||
|
||||
return coreClient;
|
||||
|
|
|
@ -44,7 +44,6 @@ 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.WebSocketExtensionRegistry;
|
||||
import org.eclipse.jetty.websocket.core.client.WebSocketCoreClient;
|
||||
import org.eclipse.jetty.websocket.javax.client.JavaxWebSocketClientContainer;
|
||||
import org.eclipse.jetty.websocket.javax.server.internal.AnnotatedServerEndpointConfig;
|
||||
import org.eclipse.jetty.websocket.javax.server.internal.JavaxWebSocketCreator;
|
||||
|
@ -138,13 +137,7 @@ public class JavaxWebSocketServerContainer
|
|||
*/
|
||||
public JavaxWebSocketServerContainer(WebSocketMapping webSocketMapping, WebSocketComponents webSocketComponents, HttpClient httpClient, Executor executor)
|
||||
{
|
||||
super(() ->
|
||||
{
|
||||
WebSocketCoreClient client = new WebSocketCoreClient(httpClient);
|
||||
if (executor != null && httpClient == null)
|
||||
client.getHttpClient().setExecutor(executor);
|
||||
return client;
|
||||
});
|
||||
super(webSocketComponents, httpClient, executor);
|
||||
this.webSocketMapping = webSocketMapping;
|
||||
this.webSocketComponents = webSocketComponents;
|
||||
this.executor = executor;
|
||||
|
|
|
@ -71,16 +71,6 @@ public class WebSocketCoreClient extends ContainerLifeCycle implements FrameHand
|
|||
addBean(httpClient);
|
||||
}
|
||||
|
||||
public FrameHandler.ConfigurationCustomizer getCustomizer()
|
||||
{
|
||||
return customizer;
|
||||
}
|
||||
|
||||
public void setCustomizer(FrameHandler.ConfigurationCustomizer customizer)
|
||||
{
|
||||
this.customizer = customizer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customize(FrameHandler.CoreSession session)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue