Package cz.marekjelen.thick

Source Code of cz.marekjelen.thick.ServerInitializer

package cz.marekjelen.thick;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;
import io.netty.handler.stream.ChunkedWriteHandler;

public class ServerInitializer extends ChannelInitializer<SocketChannel> {

    private ServerEnvironment serverEnvironment;

    public ServerInitializer(ServerEnvironment env) {
        serverEnvironment = env;
    }

    @Override
    public void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();

        pipeline.addLast("codec-http", new HttpServerCodec());

        ServerHandler handler = new ServerHandler();
        handler.setEnvironment(serverEnvironment);

        pipeline.addLast("handler", handler);
    }

}
TOP

Related Classes of cz.marekjelen.thick.ServerInitializer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.