Search in sources :

Example 1 with HttpHandler

use of org.graylog2.inputs.transports.netty.HttpHandler in project graylog2-server by Graylog2.

the class HttpTransport method getCustomChildChannelHandlers.

@Override
protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getCustomChildChannelHandlers(MessageInput input) {
    final LinkedHashMap<String, Callable<? extends ChannelHandler>> handlers = new LinkedHashMap<>();
    if (idleWriterTimeout > 0) {
        // Install read timeout handler to close idle connections after a timeout.
        // This avoids dangling HTTP connections when the HTTP client does not close the connection properly.
        // For details see: https://github.com/Graylog2/graylog2-server/issues/3223#issuecomment-270350500
        handlers.put("read-timeout-handler", () -> new ReadTimeoutHandler(idleWriterTimeout, TimeUnit.SECONDS));
    }
    handlers.put("decoder", () -> new HttpRequestDecoder(DEFAULT_MAX_INITIAL_LINE_LENGTH, DEFAULT_MAX_HEADER_SIZE, maxChunkSize));
    handlers.put("decompressor", HttpContentDecompressor::new);
    handlers.put("encoder", HttpResponseEncoder::new);
    handlers.put("aggregator", () -> new HttpObjectAggregator(maxChunkSize));
    handlers.put("http-handler", () -> new HttpHandler(enableCors));
    handlers.putAll(super.getCustomChildChannelHandlers(input));
    return handlers;
}
Also used : HttpResponseEncoder(io.netty.handler.codec.http.HttpResponseEncoder) HttpObjectAggregator(io.netty.handler.codec.http.HttpObjectAggregator) HttpHandler(org.graylog2.inputs.transports.netty.HttpHandler) HttpRequestDecoder(io.netty.handler.codec.http.HttpRequestDecoder) ReadTimeoutHandler(io.netty.handler.timeout.ReadTimeoutHandler) ChannelHandler(io.netty.channel.ChannelHandler) Callable(java.util.concurrent.Callable) LinkedHashMap(java.util.LinkedHashMap) HttpContentDecompressor(io.netty.handler.codec.http.HttpContentDecompressor)

Aggregations

ChannelHandler (io.netty.channel.ChannelHandler)1 HttpContentDecompressor (io.netty.handler.codec.http.HttpContentDecompressor)1 HttpObjectAggregator (io.netty.handler.codec.http.HttpObjectAggregator)1 HttpRequestDecoder (io.netty.handler.codec.http.HttpRequestDecoder)1 HttpResponseEncoder (io.netty.handler.codec.http.HttpResponseEncoder)1 ReadTimeoutHandler (io.netty.handler.timeout.ReadTimeoutHandler)1 LinkedHashMap (java.util.LinkedHashMap)1 Callable (java.util.concurrent.Callable)1 HttpHandler (org.graylog2.inputs.transports.netty.HttpHandler)1