Tomcat 7 comes with a lot of new features, like Servlet 3.0 specification, filter for preventing CSRF attacks, and more and more features. One feature that I really like is the simplicity that has acquired embedding a Tomcat into an application.
String webApp = ...;
String tomcatDir = ...;
Tomcat tomcat = new Tomcat();
- Configure Tomcat. The base directory for temp files.
- Adding information about where web application is deployed and which context path should serve it.
- Starting server and waits until application is closed.