Java Code Examples for io.netty.handler.codec.http2.Http2FrameCodecBuilder#headerSensitivityDetector()
The following examples show how to use
io.netty.handler.codec.http2.Http2FrameCodecBuilder#headerSensitivityDetector() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: H2ServerParentChannelInitializer.java From servicetalk with Apache License 2.0 | 6 votes |
@Override public void init(final Channel channel) { final Http2FrameCodecBuilder multiplexCodecBuilder = forServer() // We do not want close to trigger graceful closure (go away), instead when user triggers a graceful // close, we do the appropriate go away handling. .decoupleCloseAndGoAway(true) // We don't want to rely upon Netty to manage the graceful close timeout, because we expect // the user to apply their own timeout at the call site. .gracefulShutdownTimeoutMillis(-1); final BiPredicate<CharSequence, CharSequence> headersSensitivityDetector = config.headersSensitivityDetector(); multiplexCodecBuilder.headerSensitivityDetector(headersSensitivityDetector::test); final String frameLoggerName = config.frameLoggerName(); if (frameLoggerName != null) { multiplexCodecBuilder.frameLogger(new Http2FrameLogger(TRACE, frameLoggerName)); } // TODO(scott): more configuration. header validation, settings stream, etc... channel.pipeline().addLast(multiplexCodecBuilder.build(), new Http2MultiplexHandler(streamChannelInitializer)); }
Example 2
Source File: H2ClientParentChannelInitializer.java From servicetalk with Apache License 2.0 | 5 votes |
@Override public void init(final Channel channel) { final Http2FrameCodecBuilder multiplexCodecBuilder = forClient() // We do not want close to trigger graceful closure (go away), instead when user triggers a graceful // close, we do the appropriate go away handling. .decoupleCloseAndGoAway(true) // The max concurrent streams is made available via a publisher and may be consumed asynchronously // (e.g. when offloading is enabled), so we manually control the SETTINGS ACK frames. .autoAckSettingsFrame(false) // We don't want to rely upon Netty to manage the graceful close timeout, because we expect // the user to apply their own timeout at the call site. .gracefulShutdownTimeoutMillis(-1); // Notify server that this client does not support server push and request it to be disabled. multiplexCodecBuilder.initialSettings().pushEnabled(false).maxConcurrentStreams(0L); final BiPredicate<CharSequence, CharSequence> headersSensitivityDetector = config.headersSensitivityDetector(); multiplexCodecBuilder.headerSensitivityDetector(headersSensitivityDetector::test); final String frameLoggerName = config.frameLoggerName(); if (frameLoggerName != null) { multiplexCodecBuilder.frameLogger(new Http2FrameLogger(TRACE, frameLoggerName)); } // TODO(scott): more configuration. header validation, settings stream, etc... channel.pipeline().addLast(multiplexCodecBuilder.build(), new Http2MultiplexHandler(H2PushStreamHandler.INSTANCE)); }