com.github.masahitojp.botan.router.HttpRouterServerInitializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of botan-core Show documentation
Show all versions of botan-core Show documentation
tiny chat bot framework for Java SE 8.(like a Hubot)
package com.github.masahitojp.botan.router;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;
import io.netty.handler.codec.http.BadClientSilencer;
import io.netty.handler.codec.http.router.Router;
/**
*
*/
public class HttpRouterServerInitializer extends ChannelInitializer {
private final HttpRouterServerHandler handler;
private final BadClientSilencer badClientSilencer = new BadClientSilencer();
public HttpRouterServerInitializer(final Router router) {
handler = new HttpRouterServerHandler(router);
}
@Override
public void initChannel(final SocketChannel ch) {
ch.pipeline()
.addLast(new HttpServerCodec())
.addLast(handler)
.addLast(badClientSilencer);
}
}