I am currently working on an open source project (do not ask me which since it will surface soon, and I should not talk much about it till it does ;)) that required to provide web access to apps, services, and contents. From my days fighting with Mulgara descriptors I remembered that Jetty (full-featured web server implemented entirely in Java) could be embedded into applications to provide such services. It has been two months now since I started using, and it is a nice, shiny, and slick piece of software. I used Tomcat for most of my stuff, but Jetty is definitely and amazing alternative Below I just pasted one of the ways you can embed Jetty in your app.
Server server = new Server(8080);
Context root = new Context(server,"/",Context.SESSIONS);
root.addServlet(new ServletHolder(new HelloServlet("Hello World!")), "/*");
server.start();
server.join();
Yes, that’s it. You can also embed full-fledge multiple web apps using
Server server = new Server();
XmlConfiguration configuration = new XmlConfiguration(new File("myJetty.xml").toURL());
//or use new XmlConfiguration(new FileInputStream("myJetty.xml"));
configuration.configure(server);
server.start();
server.join();
Oh, and one last cool thing. You can remove apps from the server without needing to restart it! That is pretty useful.