Необходимо реализовать http-сервер на фреймворке netty (http://netty.io/), со следующим функционалом:
-
По запросу на http://somedomain/hello отдает «Hello World» через 10 секунд
-
По запросу на http://somedomain/redirect?url= происходит переадресация на указанный url
-
По запросу на http://somedomain/status выдается статистика:
-
общее количество запросов
-
количество уникальных запросов (по одному на IP)
-
счетчик запросов на каждый IP в виде таблицы с колонкам и IP, кол-во запросов, время последнего запроса
-
количество переадресаций по url’ам в виде таблицы, с колонками url, кол-во переадресация
-
количество соединений, открытых в данный момент
-
в виде таблицы лог из 16 последних обработанных соединений, колонки src_ip, URI, timestamp, sent_bytes, received_bytes, speed (bytes/sec)
Request arrives to server -> Pipeline is created -> Traffic counter starts to count -> Arrived ByteBuf is decoded to HttpRequest -> HttpServerHandler creates response (message) based on URI and requests to write this message through the pipeline -> Response gets gzipped -> Response is encoded to sequence of bytes -> Traffic counter stops to count -> Response is sent
- Server listens to one port, therefore, there is one boss thread which accepts incoming connections.
- Once the connection is established, handlers in pipeline are executed in one of the worker threads.
- Worker threads perform non-blocking IO for one or more
Channels.


