HttpRequest httpRequest = (HttpRequest) event.getMessage();
HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
IWebRequest webRequest = new NettyWebRequest(httpRequest, localAddress, remoteAddress);
IWebResponse webResponse = new NettyWebResponse(httpResponse);
WebCommand webCommand = WebContext.getWebCommand();
webCommand.run(webRequest, webResponse);
ChannelBuffer buffer = ChannelBuffers.copiedBuffer(webResponse.getBytes());
httpResponse.setContent(buffer);
httpResponse.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(buffer.readableBytes()));
// Write the response.
event.getChannel().write(httpResponse);