Example usage for io.netty.handler.codec.haproxy HAProxyMessageDecoder HAProxyMessageDecoder

List of usage examples for io.netty.handler.codec.haproxy HAProxyMessageDecoder HAProxyMessageDecoder

Introduction

In this page you can find the example usage for io.netty.handler.codec.haproxy HAProxyMessageDecoder HAProxyMessageDecoder.

Prototype

public HAProxyMessageDecoder() 

Source Link

Document

Creates a new decoder with no additional data (TLV) restrictions, and should throw an exception as soon as we exceed maxLength.

Usage

From source file:diskCacheV111.doors.NettyLineBasedDoor.java

License:Open Source License

@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
    ChannelPipeline pipeline = ctx.pipeline();
    String self = ctx.name();/*w w  w .  j a va2s. co m*/

    if (expectProxyProtocol) {
        pipeline.addBefore("door", "haproxy", new HAProxyMessageDecoder());
    }

    // Decoders
    pipeline.addBefore(self, "frameDecoder", new LineBasedFrameDecoder(KiB.toBytes(64)));
    pipeline.addBefore(self, "stringDecoder", new StringDecoder(charset));

    // Encoder
    pipeline.addBefore(self, "lineEncoder", new LineEncoder(lineSeparator, charset));

    pipeline.addBefore(self, "logger", new LoggingHandler());
}