refactor the WebAppListener and ReconnectServlet to use same connect method.