本文整理汇总了Java中io.netty.handler.codec.http2.DefaultHttp2Connection类的典型用法代码示例。如果您正苦于以下问题:Java DefaultHttp2Connection类的具体用法?Java DefaultHttp2Connection怎么用?Java DefaultHttp2Connection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultHttp2Connection类属于io.netty.handler.codec.http2包,在下文中一共展示了DefaultHttp2Connection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handlerAdded
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
LOGGER.info("{} : handlerAdded", connectionInfo);
Http2Connection connection = new DefaultHttp2Connection(true);
ChannelHandler http2ConnHandler = new HttpToHttp2ConnectionHandlerBuilder()
.frameListener(new DelegatingDecompressorFrameListener(
connection,
new InboundHttp2ToHttpAdapterBuilder(connection)
.maxContentLength(master.config().getMaxContentLength())
.propagateSettings(true)
.build()))
.connection(connection)
.frameLogger(new Http2FrameLogger(LogLevel.DEBUG))
.build();
ctx.pipeline()
.addBefore(ctx.name(), null, http2ConnHandler)
.addBefore(ctx.name(), null, new Http2Handler());
}
示例2: handlerAdded
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
LOGGER.info("{} : handlerAdded", connectionInfo);
Http2Connection connection = new DefaultHttp2Connection(false);
ChannelHandler http2ConnHandler = new HttpToHttp2ConnectionHandlerBuilder()
.frameListener(new DelegatingDecompressorFrameListener(
connection,
new InboundHttp2ToHttpAdapterBuilder(connection)
.maxContentLength(master.config().getMaxContentLength())
.propagateSettings(true)
.build()))
.frameLogger(new Http2FrameLogger(LogLevel.DEBUG))
.connection(connection)
.build();
ctx.pipeline()
.addBefore(ctx.name(), null, http2ConnHandler)
.addBefore(ctx.name(), null, new Http2Handler());
}
示例3: initChannel
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
@Override
public void initChannel(SocketChannel ch) throws Exception {
final Http2Connection connection = new DefaultHttp2Connection(false);
connectionHandler = new HttpToHttp2ConnectionHandlerBuilder()
.frameListener(new DelegatingDecompressorFrameListener(
connection,
new InboundHttp2ToHttpAdapterBuilder(connection)
.maxContentLength(maxContentLength)
.propagateSettings(true)
.build()))
.frameLogger(logger)
.connection(connection)
.build();
responseHandler = new HttpResponseHandler();
settingsHandler = new Http2SettingsHandler(ch.newPromise());
if (sslCtx != null) {
configureSsl(ch);
} else {
configureClearText(ch);
}
}
示例4: initChannel
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
@Override
public void initChannel(SocketChannel ch) throws Exception {
final Http2Connection connection = new DefaultHttp2Connection(false);
final Http2FrameWriter frameWriter = frameWriter();
connectionHandler = new HttpToHttp2ConnectionHandler(connection,
frameReader(),
frameWriter,
new DelegatingDecompressorFrameListener(connection,
new InboundHttp2ToHttpAdapter.Builder(connection)
.maxContentLength(maxContentLength)
.propagateSettings(true)
.build()));
responseHandler = new HttpResponseHandler();
settingsHandler = new Http2SettingsHandler(ch.newPromise());
configureClearText(ch);
}
示例5: initChannel
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
@Override
public void initChannel(SocketChannel ch) throws Exception {
final Http2Connection connection = new DefaultHttp2Connection(false);
connectionHandler = new HttpToHttp2ConnectionHandler(connection,
frameReader(),
frameWriter(),
new DelegatingDecompressorFrameListener(connection,
new InboundHttp2ToHttpAdapter.Builder(connection)
.maxContentLength(maxContentLength)
.propagateSettings(true)
.build()));
responseHandler = new HttpResponseHandler();
settingsHandler = new Http2SettingsHandler(ch.newPromise());
if (sslCtx != null) {
configureSsl(ch);
} else {
configureClearText(ch);
}
}
示例6: newHttp2ConnectionHandler
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
private Http2ClientConnectionHandler newHttp2ConnectionHandler(Channel ch) {
final boolean validateHeaders = false;
final Http2Connection conn = new DefaultHttp2Connection(false);
conn.addListener(new Http2GoAwayListener(ch));
Http2FrameReader reader = new DefaultHttp2FrameReader(validateHeaders);
Http2FrameWriter writer = new DefaultHttp2FrameWriter();
Http2ConnectionEncoder encoder = new DefaultHttp2ConnectionEncoder(conn, writer);
Http2ConnectionDecoder decoder = new DefaultHttp2ConnectionDecoder(conn, encoder, reader);
final Http2Settings http2Settings = http2Settings();
final Http2ResponseDecoder listener = new Http2ResponseDecoder(conn, ch, encoder);
final Http2ClientConnectionHandler handler =
new Http2ClientConnectionHandler(decoder, encoder, http2Settings, listener);
// Setup post build options
handler.gracefulShutdownTimeoutMillis(clientFactory.idleTimeoutMillis());
return handler;
}
示例7: newHttp2ConnectionHandler
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
private Http2ConnectionHandler newHttp2ConnectionHandler(ChannelPipeline pipeline) {
final Http2Connection conn = new DefaultHttp2Connection(true);
conn.addListener(new Http2GoAwayListener(pipeline.channel()));
Http2FrameReader reader = new DefaultHttp2FrameReader(true);
Http2FrameWriter writer = new DefaultHttp2FrameWriter();
Http2ConnectionEncoder encoder = new DefaultHttp2ConnectionEncoder(conn, writer);
Http2ConnectionDecoder decoder = new DefaultHttp2ConnectionDecoder(conn, encoder, reader);
final Http2ConnectionHandler handler =
new Http2ServerConnectionHandler(decoder, encoder, new Http2Settings());
// Setup post build options
final Http2RequestDecoder listener =
new Http2RequestDecoder(config, pipeline.channel(), handler.encoder());
handler.connection().addListener(listener);
handler.decoder().frameListener(listener);
handler.gracefulShutdownTimeoutMillis(config.idleTimeoutMillis());
return handler;
}
示例8: initChannel
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
@Override
public void initChannel(SocketChannel ch) throws Exception {
final Http2Connection connection = new DefaultHttp2Connection(false);
connectionHandler = new HttpToHttp2ConnectionHandlerBuilder()
.frameListener(new DelegatingDecompressorFrameListener(
connection,
new InboundHttp2ToHttpAdapterBuilder(connection)
.maxContentLength(maxContentLength)
.propagateSettings(true)
.build()))
.frameLogger(logger)
.connection(connection)
.build();
responseHandler = new HTTP2ResponseHandler();
settingsHandler = new HTTP2SettingsHandler(ch.newPromise());
if (sslCtx != null) {
configureSsl(ch);
} else {
configureClearText(ch);
}
}
示例9: newHttp2ConnectionHandler
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
private Http2ConnectionHandler newHttp2ConnectionHandler(final ChannelPipeline p) {
DefaultHttp2Connection connection = new DefaultHttp2Connection(true);
InboundHttp2ToHttpAdapter listener = new InboundHttp2ToHttpAdapterBuilder(connection)
.propagateSettings(false)
.validateHttpHeaders(false)
.maxContentLength(maxContentLength)
.build();
HttpToHttp2ConnectionHandler http2handler = new HttpToHttp2ConnectionHandlerBuilder()
.frameListener(listener)
.frameLogger(new Http2FrameLogger(LogLevel.DEBUG))
.connection(connection)
.build();
return http2handler;
}
示例10: setUp
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
@BeforeClass
public static void setUp() throws IOException, URISyntaxException,
TimeoutException {
CLUSTER = new MiniDFSCluster.Builder(CONF).numDataNodes(1).build();
CLUSTER.waitActive();
RESPONSE_HANDLER = new Http2ResponseHandler();
Bootstrap bootstrap =
new Bootstrap()
.group(WORKER_GROUP)
.channel(NioSocketChannel.class)
.remoteAddress("127.0.0.1",
CLUSTER.getDataNodes().get(0).getInfoPort())
.handler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel ch) throws Exception {
Http2Connection connection = new DefaultHttp2Connection(false);
Http2ConnectionHandler connectionHandler =
new HttpToHttp2ConnectionHandler(connection, frameReader(),
frameWriter(), new DelegatingDecompressorFrameListener(
connection, new InboundHttp2ToHttpAdapter.Builder(
connection).maxContentLength(Integer.MAX_VALUE)
.propagateSettings(true).build()));
ch.pipeline().addLast(connectionHandler, RESPONSE_HANDLER);
}
});
CHANNEL = bootstrap.connect().syncUninterruptibly().channel();
}
示例11: configureHttp2
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
private static void configureHttp2(ChannelHandlerContext ctx) {
DefaultHttp2Connection connection = new DefaultHttp2Connection(true);
InboundHttp2ToHttpAdapter listener = new InboundHttp2ToHttpAdapterBuilder(connection)
.propagateSettings(true).validateHttpHeaders(false)
.maxContentLength(MAX_CONTENT_LENGTH).build();
ctx.pipeline().addLast(new HttpToHttp2ConnectionHandlerBuilder()
.frameListener(listener)
// .frameLogger(TilesHttp2ToHttpHandler.logger)
.connection(connection).build());
ctx.pipeline().addLast(new Http2RequestHandler());
}
示例12: initChannel
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
@Override
public void initChannel(SocketChannel ch) throws Exception {
final ChannelPipeline p = ch.pipeline();
final Http2Connection conn = new DefaultHttp2Connection(false);
final HttpToHttp2ConnectionHandler connHandler = new HttpToHttp2ConnectionHandlerBuilder()
.connection(conn)
.frameListener(new DelegatingDecompressorFrameListener(
conn,
new InboundHttp2ToHttpAdapterBuilder(conn)
.maxContentLength(Integer.MAX_VALUE)
.propagateSettings(true).build()))
.build();
clientHandler = new THttp2ClientHandler(ch.eventLoop());
if (sslCtx != null) {
p.addLast(sslCtx.newHandler(p.channel().alloc()));
p.addLast(connHandler);
configureEndOfPipeline(p);
} else {
Http1ClientCodec sourceCodec = new Http1ClientCodec();
HttpClientUpgradeHandler upgradeHandler = new HttpClientUpgradeHandler(
sourceCodec, new Http2ClientUpgradeCodec(connHandler), 65536);
p.addLast(sourceCodec, upgradeHandler, new UpgradeRequestHandler());
}
}
示例13: build
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
@Override
protected HTTP2SourceHandler build(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder,
Http2Settings initialSettings) {
HTTP2SourceHandler handler = new HTTP2SourceHandler(decoder, encoder, initialSettings, connectionManager,
listenerConfiguration);
frameListener(handler);
connection(new DefaultHttp2Connection(true));
return handler;
}
示例14: newHandler
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
static NettyClientHandler newHandler(
ClientTransportLifecycleManager lifecycleManager,
@Nullable KeepAliveManager keepAliveManager,
int flowControlWindow,
int maxHeaderListSize,
Supplier<Stopwatch> stopwatchFactory,
Runnable tooManyPingsRunnable,
TransportTracer transportTracer) {
Preconditions.checkArgument(maxHeaderListSize > 0, "maxHeaderListSize must be positive");
Http2HeadersDecoder headersDecoder = new GrpcHttp2ClientHeadersDecoder(maxHeaderListSize);
Http2FrameReader frameReader = new DefaultHttp2FrameReader(headersDecoder);
Http2FrameWriter frameWriter = new DefaultHttp2FrameWriter();
Http2Connection connection = new DefaultHttp2Connection(false);
WeightedFairQueueByteDistributor dist = new WeightedFairQueueByteDistributor(connection);
dist.allocationQuantum(16 * 1024); // Make benchmarks fast again.
DefaultHttp2RemoteFlowController controller =
new DefaultHttp2RemoteFlowController(connection, dist);
connection.remote().flowController(controller);
return newHandler(
connection,
frameReader,
frameWriter,
lifecycleManager,
keepAliveManager,
flowControlWindow,
maxHeaderListSize,
stopwatchFactory,
tooManyPingsRunnable,
transportTracer);
}
示例15: newHandler
import io.netty.handler.codec.http2.DefaultHttp2Connection; //导入依赖的package包/类
@Override
protected NettyClientHandler newHandler() throws Http2Exception {
Http2Connection connection = new DefaultHttp2Connection(false);
// Create and close a stream previous to the nextStreamId.
Http2Stream stream = connection.local().createStream(streamId - 2, true);
stream.close();
final Ticker ticker = new Ticker() {
@Override
public long read() {
return nanoTime;
}
};
Supplier<Stopwatch> stopwatchSupplier = new Supplier<Stopwatch>() {
@Override
public Stopwatch get() {
return Stopwatch.createUnstarted(ticker);
}
};
return NettyClientHandler.newHandler(
connection,
frameReader(),
frameWriter(),
lifecycleManager,
mockKeepAliveManager,
flowControlWindow,
maxHeaderListSize,
stopwatchSupplier,
tooManyPingsRunnable,
transportTracer);
}