How to do the following with netty:
- if uri starts "/static/*" path use StaticHttpHandler
- if other uri uses HttpHandler
- if "/ws" use WebSocketHandler
Now I have this code:
public class HttpHelloWorldServerInitializer extends ChannelInitializer<SocketChannel> {
@Override
public void initChannel(SocketChannel ch) {
ChannelPipeline p = ch.pipeline();
p.addLast(new HttpServerCodec());
p.addLast(new HttpHandler());
// Other pipelene handlers?
}
}
Can I use something like "swither" in pipeline? Or it doesn't make sense and I need to handle request uri inside handler. But how to determine websocket protocol?