Sunday, October 05, 2008

Embedded Jetty

I wanted to use Jetty in embedded mode to run a simple AXIS server (for web services support for students).
Since the students have a limited amount of space, having a <5Mb web application service sounds nice.

(I set up Tomcat, and reduced it to 4.6Mb by having lots of symlinks to /usr/share/java which we happened to have a lot of the common libraries installed)
Using symlinks (again) I should be able to reduce this to < 2Mb.

Anyway, found out how to embed Jetty ... might make my own axis "simpleJettyServer" based on the following. ps: I wonder how you map using this?


So Long WTP, Embedded Jetty for Me - Code Commit: "



public class StartApplication {
public static void main(String[] args) throws Exception {
Server server = new Server(8080);
Context context = new Context(server, "/", Context.SESSIONS);

ServletHolder servletHolder = new ServletHolder(new WicketServlet());
servletHolder.setInitParameter("applicationClassName",
"com.myapp.wicket.Application");
servletHolder.setInitOrder(1);
context.addServlet(servletHolder, "/*");

server.start();
server.join();
}
}

No comments: