/*
 * Copyright (c) 2015 Paul Ambrose
 */

package io.haptava.examples.heroku;

import io.haptava.examples.heroku.servlets.DefaultServlet;
import io.haptava.examples.heroku.servlets.DynoContextListener;
import io.haptava.examples.heroku.servlets.ResetServlet;
import io.haptava.examples.heroku.servlets.SummaryServlet;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.ServletHolder;

public class PageServer {

  public static void main(final String[] argv)
      throws Exception {

    int port = Integer.valueOf(System.getenv("PORT"));

    new Server(port) {{
      setHandler(
          new Context(Context.SESSIONS) {{
            setContextPath("/");
            addEventListener(new DynoContextListener());
            addServlet(new ServletHolder(new ResetServlet()), "/reset");
            addServlet(new ServletHolder(new SummaryServlet()), "/summary");
            addServlet(new ServletHolder(new DefaultServlet()), "/*");
          }});
      start();
      join();
    }};
  }
}

@@ -544,111 +544,31 @@
     
+f
 in
-t port = Integer.valueOf(System.getenv(%22PORT%22));%0A%0A    new Server(port) %7B%7B%0A      setHandler(%0A         
+al Context context =
  new
@@ -597,24 +597,22 @@
 ONS)
- %7B%7B
+;
 %0A    
-        
+context.
 setC
@@ -632,24 +632,24 @@
 %22);%0A    
-        
+context.
 addEvent
@@ -685,32 +685,32 @@
 ner());%0A    
-        
+context.
 addServlet(n
@@ -758,32 +758,32 @@
 eset%22);%0A    
-        
+context.
 addServlet(n
@@ -839,24 +839,24 @@
 %22);%0A    
-        
+context.
 addServl
@@ -910,58 +910,177 @@
 %22);%0A
+%0A
     
-      %7D%7D);%0A      start();%0A      join();%0A    %7D%7D
+int port = Integer.valueOf(System.getenv(%22PORT%22));%0A    final Server server = new Server(port);%0A    server.setHandler(context);%0A    server.start();%0A    server.join()
 ;%0A  

Remove anonymous classes