io.jooby.internal.netty.Http2Extension Maven / Gradle / Ivy
The newest version!
/*
* Jooby https://jooby.io
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
* Copyright 2014 Edgar Espina
*/
package io.jooby.internal.netty;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import io.netty.channel.ChannelOutboundHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.http.HttpServerUpgradeHandler;
public class Http2Extension {
private Http2Settings settings;
private Consumer http11;
private BiConsumer>
http11Upgrade;
private BiConsumer> http2;
private BiConsumer> http2c;
public Http2Extension(
Http2Settings settings,
Consumer http11,
BiConsumer> http11Upgrade,
BiConsumer> http2,
BiConsumer> http2c) {
this.settings = settings;
this.http11 = http11;
this.http11Upgrade = http11Upgrade;
this.http2 = http2;
this.http2c = http2c;
}
public boolean isSecure() {
return settings.isSecure();
}
public void http11(ChannelPipeline pipeline) {
this.http11.accept(pipeline);
}
public void http2(
ChannelPipeline pipeline, Function factory) {
this.http2.accept(pipeline, () -> factory.apply(settings));
}
public void http2c(
ChannelPipeline pipeline, Function factory) {
this.http2c.accept(pipeline, () -> factory.apply(settings));
}
public void http11Upgrade(
ChannelPipeline pipeline,
Function factory) {
this.http11Upgrade.accept(pipeline, () -> factory.apply(settings));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy