Search in sources :

Example 11 with ContainerLifeCycle

use of org.eclipse.jetty.util.component.ContainerLifeCycle in project jetty.project by eclipse.

the class SslClientConnectionFactory method customize.

@Override
public Connection customize(Connection connection, Map<String, Object> context) {
    if (connection instanceof SslConnection) {
        SslConnection sslConnection = (SslConnection) connection;
        sslConnection.setRenegotiationAllowed(sslContextFactory.isRenegotiationAllowed());
        ContainerLifeCycle connector = (ContainerLifeCycle) context.get(ClientConnectionFactory.CONNECTOR_CONTEXT_KEY);
        connector.getBeans(SslHandshakeListener.class).forEach(sslConnection::addHandshakeListener);
    }
    return ClientConnectionFactory.super.customize(connection, context);
}
Also used : ContainerLifeCycle(org.eclipse.jetty.util.component.ContainerLifeCycle)

Example 12 with ContainerLifeCycle

use of org.eclipse.jetty.util.component.ContainerLifeCycle in project jetty.project by eclipse.

the class WebSocketCdiListener method lifeCycleStarting.

@Override
public void lifeCycleStarting(LifeCycle event) {
    if (event instanceof WebSocketContainerScope) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("started websocket container [{}]", event);
        }
        ContainerListener listener = new ContainerListener((WebSocketContainerScope) event);
        if (event instanceof ContainerLifeCycle) {
            ContainerLifeCycle container = (ContainerLifeCycle) event;
            container.addLifeCycleListener(listener);
            container.addEventListener(listener);
        } else {
            throw new RuntimeException("Unable to setup CDI against non-container: " + event.getClass().getName());
        }
    }
}
Also used : WebSocketContainerScope(org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope) ContainerLifeCycle(org.eclipse.jetty.util.component.ContainerLifeCycle)

Aggregations

ContainerLifeCycle (org.eclipse.jetty.util.component.ContainerLifeCycle)12 Test (org.junit.Test)2 Managed (com.acme.Managed)1 ConnectorFactory (io.dropwizard.jetty.ConnectorFactory)1 HttpConnectorFactory (io.dropwizard.jetty.HttpConnectorFactory)1 JettyManaged (io.dropwizard.lifecycle.JettyManaged)1 Managed (io.dropwizard.lifecycle.Managed)1 ArrayList (java.util.ArrayList)1 SSLEngine (javax.net.ssl.SSLEngine)1 SslConnection (org.eclipse.jetty.io.ssl.SslConnection)1 SslHandshakeListener (org.eclipse.jetty.io.ssl.SslHandshakeListener)1 Connector (org.eclipse.jetty.server.Connector)1 Container (org.eclipse.jetty.util.component.Container)1 LifeCycle (org.eclipse.jetty.util.component.LifeCycle)1 QueuedThreadPool (org.eclipse.jetty.util.thread.QueuedThreadPool)1 WebSocketContainerScope (org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope)1 Before (org.junit.Before)1