I am using netty 4.0.25Final to write a netty HTTP server. I need to add various handlers in the pipeline depending upon some parameters in HTTP GET request.
pipeline.addLast(new HttpRequestDecoder(4096, 8192, 8192, false),
new HttpResponseEncoder(),
new HttpObjectAggregator(1048576),
decisionHandler
);
Same pipeline is used if multiple requests come from the same connection. Request1 may need Handler1, Request2 may need Handler2 and Request3 may need Handler3. Suppose requests are coming as Request1, Request2, Request3. Request1 would modify the pipeline to add Handler1.
In subsequent calls do we always need to check if the pipleline is already modified, then remove the unwanted handlers? And then add the required handlers which are needed to handler that particular call?
Or should I remove the handler before going to the next handler (fireChannelRead(object))? Will it have performance impact?
Is there any other way to do this?
Thanks & Regards,
Tanima