// Create request/response
final PooledServerRequest request = messagePool.getRequest();
request.init(ctx.channel(), msg, relativePath);
final RequestHandler handler = mapping.handler(request);
final PooledServerResponse response = messagePool.getResponse();
response.init(ctx, this, handler, request, config.logger());
// Store in ChannelHandlerContext for future reference
ctx.attr(ATTR_RESPONSE).set(response);
try {
// Process request
handler.onRequest(request, response);
} catch (final Throwable t) {
// Catch server errors
response.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);