Example usage for io.netty.channel ChannelPipeline addLast

List of usage examples for io.netty.channel ChannelPipeline addLast

Introduction

In this page you can find the example usage for io.netty.channel ChannelPipeline addLast.

Prototype

ChannelPipeline addLast(ChannelHandler... handlers);

Source Link

Document

Inserts ChannelHandler s at the last position of this pipeline.

Usage

From source file:com.neverwinterdp.netty.rpc.client.RPCClientInitializer.java

License:Apache License

@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline p = ch.pipeline();
    if (sslCtx != null) {
        p.addLast(sslCtx.newHandler(ch.alloc(), RPCClient.HOST, RPCClient.PORT));
    }//  w w  w  .  j  a  va2  s  . co  m

    p.addLast(new ProtobufVarint32FrameDecoder());
    p.addLast(new ProtobufDecoder(WirePayload.getDefaultInstance()));

    p.addLast(new ProtobufVarint32LengthFieldPrepender());
    p.addLast(new ProtobufEncoder());

    p.addLast(new RPCClientHandler());
}

From source file:com.newlandframework.rpc.netty.handler.HessianRecvHandler.java

License:Apache License

public void handle(Map<String, Object> handlerMap, ChannelPipeline pipeline) {
    HessianCodecUtil util = new HessianCodecUtil();
    pipeline.addLast(new HessianEncoder(util));
    pipeline.addLast(new HessianDecoder(util));
    pipeline.addLast(new MessageRecvHandler(handlerMap));
}

From source file:com.newlandframework.rpc.netty.handler.HessianSendHandler.java

License:Apache License

public void handle(ChannelPipeline pipeline) {
    HessianCodecUtil util = new HessianCodecUtil();
    pipeline.addLast(new HessianEncoder(util));
    pipeline.addLast(new HessianDecoder(util));
    pipeline.addLast(new MessageSendHandler());
}

From source file:com.newlandframework.rpc.netty.handler.JdkNativeRecvHandler.java

License:Apache License

public void handle(Map<String, Object> handlerMap, ChannelPipeline pipeline) {
    pipeline.addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, MessageCodecUtil.MESSAGE_LENGTH, 0,
            MessageCodecUtil.MESSAGE_LENGTH));
    pipeline.addLast(new LengthFieldPrepender(MessageCodecUtil.MESSAGE_LENGTH));
    pipeline.addLast(new ObjectEncoder());
    pipeline.addLast(new ObjectDecoder(Integer.MAX_VALUE,
            ClassResolvers.weakCachingConcurrentResolver(this.getClass().getClassLoader())));
    pipeline.addLast(new MessageRecvHandler(handlerMap));
}

From source file:com.newlandframework.rpc.netty.handler.JdkNativeSendHandler.java

License:Apache License

public void handle(ChannelPipeline pipeline) {
    pipeline.addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, MessageCodecUtil.MESSAGE_LENGTH, 0,
            MessageCodecUtil.MESSAGE_LENGTH));
    pipeline.addLast(new LengthFieldPrepender(MessageCodecUtil.MESSAGE_LENGTH));
    pipeline.addLast(new ObjectEncoder());
    pipeline.addLast(new ObjectDecoder(Integer.MAX_VALUE,
            ClassResolvers.weakCachingConcurrentResolver(this.getClass().getClassLoader())));
    pipeline.addLast(new MessageSendHandler());
}

From source file:com.newlandframework.rpc.netty.handler.KryoRecvHandler.java

License:Apache License

public void handle(Map<String, Object> handlerMap, ChannelPipeline pipeline) {
    KryoCodecUtil util = new KryoCodecUtil(KryoPoolFactory.getKryoPoolInstance());
    pipeline.addLast(new KryoEncoder(util));
    pipeline.addLast(new KryoDecoder(util));
    pipeline.addLast(new MessageRecvHandler(handlerMap));
}

From source file:com.newlandframework.rpc.netty.handler.KryoSendHandler.java

License:Apache License

public void handle(ChannelPipeline pipeline) {
    KryoCodecUtil util = new KryoCodecUtil(KryoPoolFactory.getKryoPoolInstance());
    pipeline.addLast(new KryoEncoder(util));
    pipeline.addLast(new KryoDecoder(util));
    pipeline.addLast(new MessageSendHandler());
}

From source file:com.newlandframework.rpc.netty.handler.ProtostuffRecvHandler.java

License:Apache License

public void handle(Map<String, Object> handlerMap, ChannelPipeline pipeline) {
    ProtostuffCodecUtil util = new ProtostuffCodecUtil();
    util.setRpcDirect(true);//from ww  w  .  j av  a  2  s . c om
    pipeline.addLast(new ProtostuffEncoder(util));
    pipeline.addLast(new ProtostuffDecoder(util));
    pipeline.addLast(new MessageRecvHandler(handlerMap));
}

From source file:com.newlandframework.rpc.netty.handler.ProtostuffSendHandler.java

License:Apache License

public void handle(ChannelPipeline pipeline) {
    ProtostuffCodecUtil util = new ProtostuffCodecUtil();
    util.setRpcDirect(false);/*from w w w.j a va 2s.  com*/
    pipeline.addLast(new ProtostuffEncoder(util));
    pipeline.addLast(new ProtostuffDecoder(util));
    pipeline.addLast(new MessageSendHandler());
}

From source file:com.nextcont.ecm.fileengine.http.nettyServer.HttpUploadServerInitializer.java

License:Apache License

@Override
public void initChannel(SocketChannel ch) {
    System.out.println("--------------- initChannel ----------------");
    ChannelPipeline pipeline = ch.pipeline();

    if (sslCtx != null) {
        pipeline.addLast(sslCtx.newHandler(ch.alloc()));
    }/*from w  w w .  j  a  va 2s.  c  o  m*/
    //        pipeline.addLast(new HttpRequestDecoder());
    //        pipeline.addLast(new HttpResponseEncoder());

    pipeline.addLast(new HttpServerCodec());
    pipeline.addLast(new ChunkedWriteHandler());

    pipeline.addLast(new HttpUploadServerHandler(fileService, fileRecordManager));

}