// we cannot throw the exception here
LOG.warn("HttpServerChannelHandler is not found as attachment to handle exception, send 404 back to the client.", e.getCause());
// Now we just send 404 back to the client
HttpResponse response = new DefaultHttpResponse(HTTP_1_1, NOT_FOUND);
response.headers().set(Exchange.CONTENT_TYPE, "text/plain");
response.headers().set(Exchange.CONTENT_LENGTH, 0);
// Here we don't want to expose the exception detail to the client
response.setContent(ChannelBuffers.copiedBuffer(new byte[]{}));
ctx.getChannel().write(response);
}
}