I\'m writing some example code where an embedded Jetty server is started. The server must load exactly one servlet, send all requests to the servlet and listen on localhost:80>
static void startJetty() {
try {
Server server = new Server();
Connector con = new SelectChannelConnector();
con.setPort(80);
server.addConnector(con);
Context context = new Context(server, "/", Context.SESSIONS);
context.addServlet(new ServletHolder(new MyApp()), "/*");
server.start();
} catch (Exception ex) {
System.err.println(ex);
}
}
Removed unnecessary whitespace and moved ServletHolder creation inline. That's removed 5 lines.