title: Scala Jetty webapp on Heroku 404
body: <p>I'm testing around with a Scala web framework (Udash) and trying to run a toy-example in Heroku. I have it running without issues in local following the instructions in the Heroku docs:</p>
  
  <pre><code>sbt compile stage
  heroku local web
  </code></pre>
  
  <p>However, once deployed, any URL I type goes to 404, even the landing page of the app. These are the objects I am using:</p>
  
  <pre class="lang-scala prettyprint-override"><code>object Launcher extends CrossLogging {
    def main(args: Array[String]): Unit = {
      val port = Properties.envOrElse("PORT", "5000").toInt
      val server = new ApplicationServer(port, "frontend/target/UdashStatics/WebContent")
      server.start()
      logger.info(s"Application started...")
    }
  }
  
  class ApplicationServer(val port: Int, resourceBase: String) {
    private val server = new Server(port)
    private val contextHandler = new ServletContextHandler
    private val appHolder = createAppHolder()
  
    contextHandler.setSessionHandler(new SessionHandler)
    contextHandler.setGzipHandler(new GzipHandler)
    contextHandler.getSessionHandler.addEventListener(new org.atmosphere.cpr.SessionSupport())
    contextHandler.addServlet(appHolder, "/*")
    server.setHandler(contextHandler)
  
    def start(): Unit = server.start()
    def stop(): Unit = server.stop()
  
    private def createAppHolder() = {
      val appHolder = new ServletHolder(new DefaultServlet)
      appHolder.setAsyncSupported(true)
      appHolder.setInitParameter("resourceBase", resourceBase)
      appHolder
    }
  }
  
  </code></pre>
  
  <p>Is there any Heroku configuration/characteristic that I am missing?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Tried to apply the changes suggested and ended up with the following ApplicationContext:</p>
  
  <pre class="lang-scala prettyprint-override"><code>class ApplicationServer(val port: Int, val resourceBase: String) {
    val server = new Server()
    val connector = new ServerConnector(server)
    connector.setPort(port)
    server.addConnector(connector)
    private val appHolder = createAppHolder()
  
    val context = new ServletContextHandler(ServletContextHandler.SESSIONS)
  
    context.setBaseResource(Resource.newResource(resourceBase))
    context.setContextPath("/")
    context.addServlet(appHolder, "/")
    server.setHandler(context)
  
    private def createAppHolder() = {
      val appHolder = new ServletHolder("default", classOf[DefaultServlet])
      appHolder.setInitParameter("dirAllowed", "true")
      appHolder.setInitParameter("resourceBase", resourceBase)
      appHolder
    }
  
    def start(): Unit = server.start()
    def stop(): Unit = server.stop()
  }
  </code></pre>
  
  <p>However, I still get Error 404 even on landing page after deploying to Heroku:</p>
  
  <pre><code>HTTP ERROR 404
  Problem accessing /. Reason:
      Not Found
  </code></pre>
  
  <p>When running the app on local I get to the landing page correctly.</p>
  
  <p>Thank you!
  Thanks!</p>