Can a ChannelHandler trigger an early exit from a ChannelPipeline

(Georgios Moschovitis) #1

I would like to have an AuthenticationHandler as a first stage (ChannelnboundHandler) in a ChannelPipeline. If the authentication check fails I would like to return an error response and skip the evaluation of the remaining handlers in the pipeline.

I would be nice if the documentation could be amended with some example for such use cases.

(Helge Heß) #2

Subsequent handlers are not "automatically" called anyways. So if you inject an authentication handler in the pipeline, and the authentication did succeed, your auth handler is responsible for passing the data on (by calling fireChannelRead).

Here is an example for this. The NIOIRC parses ByteBuffers into IRCMessage values, and then passes them up the pipeline via fireChannelRead:

(Georgios Moschovitis) #3

Thank you!