Include HTTP2ServerConnectionFactory in JettyHttpConfigurationCustomizer
This commit is contained in:
parent
d10da39e5b
commit
75bb22f08b
|
@ -5,23 +5,39 @@
|
||||||
|
|
||||||
package org.whispersystems.textsecuregcm.jetty;
|
package org.whispersystems.textsecuregcm.jetty;
|
||||||
|
|
||||||
|
import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory;
|
||||||
|
import org.eclipse.jetty.server.ConnectionFactory;
|
||||||
import org.eclipse.jetty.server.Connector;
|
import org.eclipse.jetty.server.Connector;
|
||||||
|
import org.eclipse.jetty.server.HttpConfiguration;
|
||||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||||
import org.eclipse.jetty.util.component.Container;
|
import org.eclipse.jetty.util.component.Container;
|
||||||
import org.eclipse.jetty.util.component.LifeCycle;
|
import org.eclipse.jetty.util.component.LifeCycle;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses {@link Container.Listener} to update {@link org.eclipse.jetty.server.HttpConfiguration}
|
* Uses {@link Container.Listener} to update {@link org.eclipse.jetty.server.HttpConfiguration}
|
||||||
*/
|
*/
|
||||||
public class JettyHttpConfigurationCustomizer implements Container.Listener, LifeCycle.Listener {
|
public class JettyHttpConfigurationCustomizer implements Container.Listener, LifeCycle.Listener {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(JettyHttpConfigurationCustomizer.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beanAdded(final Container parent, final Object child) {
|
public void beanAdded(final Container parent, final Object child) {
|
||||||
if (child instanceof Connector c) {
|
if (child instanceof Connector c) {
|
||||||
final HttpConnectionFactory hcf = c.getConnectionFactory(HttpConnectionFactory.class);
|
|
||||||
if (hcf != null) {
|
for (ConnectionFactory cf : c.getConnectionFactories()) {
|
||||||
// see https://github.com/jetty/jetty.project/issues/1891
|
final HttpConfiguration httpConfiguration = switch (cf) {
|
||||||
hcf.getHttpConfiguration().setNotifyRemoteAsyncErrors(false);
|
case HTTP2ServerConnectionFactory h2cf -> h2cf.getHttpConfiguration();
|
||||||
|
case HttpConnectionFactory hcf -> hcf.getHttpConfiguration();
|
||||||
|
default -> null;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (httpConfiguration != null) {
|
||||||
|
// see https://github.com/jetty/jetty.project/issues/1891
|
||||||
|
logger.info("setNotifyRemoteAsyncErrors(false) for {}", cf);
|
||||||
|
httpConfiguration.setNotifyRemoteAsyncErrors(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue