public void doPost(HttpServletRequest request,
                       HttpServletResponse response) throws ServletException, IOException {

        final String path = request.getPathInfo();
        String ssid = request.getSession().getId();
        response.setContentType("text/html;charset=utf-8");

        response.setStatus(HttpServletResponse.SC_OK);

        URL urlResource = (URL) Resources.getInstance().getResource("data/url.xml");

        if (path.equals(urlResource.getRegister())) {
            String login = request.getParameter("login");
            String password = request.getParameter("password");
            messageService.sendMessage( new MsgAddUser(
                                            this.getAddress(),
                                            messageService.getAddressService().getAccountServiceAddress(),
                                            login,
                                            password,
                                            ssid
                                            )
                                        );
            sessionIdToUserSession.put(ssid, new UserSession(ssid, login, UserSession.Status.waitingReg));
        }
        if (path.equals(urlResource.getLogin())) {
            String login = request.getParameter("login");
            String password = request.getParameter("password");
            messageService.sendMessage( new MsgAuthUser(
                                            this.getAddress(),
                                            messageService.getAddressService().getAccountServiceAddress(),
                                            login,
                                            password,
                                            request.getSession().getId()
                                            )
                                        );

            for (String userSessionId: sessionIdToUserSession.keySet()) {
                UserSession userSession = sessionIdToUserSession.get(userSessionId);
                if (userSession.getLogin().equals(login)) {
                    sessionIdToUserSession.remove(userSessionId);
                }
            }
            sessionIdToUserSession.put(ssid, new UserSession(ssid, login, UserSession.Status.waitingLogin));
        }

        response.sendRedirect(urlResource.getTimerPage());
    }