Issue #6106 - fix WebSocket/CDI integration
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
c29bad2301
commit
ac5eb54e1e
|
@ -40,9 +40,9 @@ public class WebSocketServerComponents extends WebSocketComponents
|
||||||
public static final String WEBSOCKET_DEFLATER_POOL_ATTRIBUTE = "jetty.websocket.deflater";
|
public static final String WEBSOCKET_DEFLATER_POOL_ATTRIBUTE = "jetty.websocket.deflater";
|
||||||
public static final String WEBSOCKET_BUFFER_POOL_ATTRIBUTE = "jetty.websocket.bufferPool";
|
public static final String WEBSOCKET_BUFFER_POOL_ATTRIBUTE = "jetty.websocket.bufferPool";
|
||||||
|
|
||||||
WebSocketServerComponents(InflaterPool inflaterPool, DeflaterPool deflaterPool, ByteBufferPool bufferPool)
|
WebSocketServerComponents(InflaterPool inflaterPool, DeflaterPool deflaterPool, ByteBufferPool bufferPool, DecoratedObjectFactory objectFactory)
|
||||||
{
|
{
|
||||||
super(null, null, bufferPool, inflaterPool, deflaterPool);
|
super(null, objectFactory, bufferPool, inflaterPool, deflaterPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -79,7 +79,10 @@ public class WebSocketServerComponents extends WebSocketComponents
|
||||||
if (bufferPool == null)
|
if (bufferPool == null)
|
||||||
bufferPool = server.getBean(ByteBufferPool.class);
|
bufferPool = server.getBean(ByteBufferPool.class);
|
||||||
|
|
||||||
WebSocketComponents serverComponents = new WebSocketServerComponents(inflaterPool, deflaterPool, bufferPool);
|
DecoratedObjectFactory objectFactory = (DecoratedObjectFactory)servletContext.getAttribute(DecoratedObjectFactory.ATTR);
|
||||||
|
WebSocketComponents serverComponents = new WebSocketServerComponents(inflaterPool, deflaterPool, bufferPool, objectFactory);
|
||||||
|
if (objectFactory != null)
|
||||||
|
serverComponents.unmanage(objectFactory);
|
||||||
|
|
||||||
// These components may be managed by the server but not yet started.
|
// These components may be managed by the server but not yet started.
|
||||||
// In this case we don't want them to be managed by the components as well.
|
// In this case we don't want them to be managed by the components as well.
|
||||||
|
|
|
@ -168,6 +168,9 @@ public class JavaxWebSocketFrameHandler implements FrameHandler
|
||||||
binaryMetadata = actualBinaryMetadata;
|
binaryMetadata = actualBinaryMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Decorate the endpointInstance directly before calling the onOpen method.
|
||||||
|
coreSession.getWebSocketComponents().getObjectFactory().decorate(endpointInstance);
|
||||||
|
|
||||||
if (openHandle != null)
|
if (openHandle != null)
|
||||||
openHandle.invoke();
|
openHandle.invoke();
|
||||||
|
|
||||||
|
|
|
@ -169,6 +169,9 @@ public class JettyWebSocketFrameHandler implements FrameHandler
|
||||||
if (binaryHandle != null)
|
if (binaryHandle != null)
|
||||||
binarySink = JettyWebSocketFrameHandlerFactory.createMessageSink(binaryHandle, binarySinkClass, executor, session);
|
binarySink = JettyWebSocketFrameHandlerFactory.createMessageSink(binaryHandle, binarySinkClass, executor, session);
|
||||||
|
|
||||||
|
// Decorate the endpointInstance directly before calling the onOpen method.
|
||||||
|
coreSession.getWebSocketComponents().getObjectFactory().decorate(endpointInstance);
|
||||||
|
|
||||||
if (openHandle != null)
|
if (openHandle != null)
|
||||||
openHandle.invoke();
|
openHandle.invoke();
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
//
|
//
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// Copyright (c) Webtide LLC and others.
|
// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others.
|
||||||
//
|
//
|
||||||
// This program and the accompanying materials are made available under
|
// This program and the accompanying materials are made available under the
|
||||||
// the terms of the Eclipse Public License 2.0 which is available at
|
// terms of the Eclipse Public License v. 2.0 which is available at
|
||||||
// https://www.eclipse.org/legal/epl-2.0
|
// 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.
|
||||||
// This Source Code may also be made available under the following
|
|
||||||
// Secondary Licenses when the conditions for such availability set
|
|
||||||
// forth in the Eclipse Public License, v. 2.0 are satisfied:
|
|
||||||
// the Apache License v2.0 which is available at
|
|
||||||
// https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
//
|
//
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// Copyright (c) Webtide LLC and others.
|
// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others.
|
||||||
//
|
//
|
||||||
// This program and the accompanying materials are made available under
|
// This program and the accompanying materials are made available under the
|
||||||
// the terms of the Eclipse Public License 2.0 which is available at
|
// terms of the Eclipse Public License v. 2.0 which is available at
|
||||||
// https://www.eclipse.org/legal/epl-2.0
|
// 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.
|
||||||
// This Source Code may also be made available under the following
|
|
||||||
// Secondary Licenses when the conditions for such availability set
|
|
||||||
// forth in the Eclipse Public License, v. 2.0 are satisfied:
|
|
||||||
// the Apache License v2.0 which is available at
|
|
||||||
// https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
|
|
@ -1,16 +1,11 @@
|
||||||
//
|
//
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// Copyright (c) Webtide LLC and others.
|
// Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others.
|
||||||
//
|
//
|
||||||
// This program and the accompanying materials are made available under
|
// This program and the accompanying materials are made available under the
|
||||||
// the terms of the Eclipse Public License 2.0 which is available at
|
// terms of the Eclipse Public License v. 2.0 which is available at
|
||||||
// https://www.eclipse.org/legal/epl-2.0
|
// 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.
|
||||||
// This Source Code may also be made available under the following
|
|
||||||
// Secondary Licenses when the conditions for such availability set
|
|
||||||
// forth in the Eclipse Public License, v. 2.0 are satisfied:
|
|
||||||
// the Apache License v2.0 which is available at
|
|
||||||
// https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
|
Loading…
Reference in New Issue