how tomcat works