I've a Camel RestConfiguration in place using the "netty-http" component
and configure a custom 'decoder'.
The 'decoder' handler is for authentication purposes, the intent is to
let the request through, or not.
In case the request should not propagate further, the decoder handler
directly writes the HTTP response.
Is this a supported use case? If have code like the following.
protected void channelRead0(ChannelHandlerContext ctx,
DefaultHttpRequest httpReq) throws Exception {
if (allIsGood) {
ctx.fireChannelRead(httpReq);
} else {
HttpResponseStatus rspStatus = HttpResponseStatus.valueOf(401,
"no access");
FullHttpResponse response = new
DefaultFullHttpResponse(HttpVersion.HTTP_1_1, rspStatus,
Unpooled.EMPTY_BUFFER);
ctx.writeAndFlush(response);
ctx.close();
}
}
However, even in the else case, Camel's
HttpServerMultiplexChannelHandler is still called.
I'd not have expected that.