Skip to content

Instantly share code, notes, and snippets.

@ryanoneill
Created April 9, 2012 03:49
Show Gist options
  • Save ryanoneill/2341254 to your computer and use it in GitHub Desktop.
Save ryanoneill/2341254 to your computer and use it in GitHub Desktop.
JettyLauncher for Lift Framework for use with Heroku
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.servlet.{DefaultServlet, ServletContextHandler}
import org.eclipse.jetty.server.nio.SelectChannelConnector
import net.liftweb.http.LiftFilter
object JettyLauncher extends App {
// Slightly modified from
// https://github.com/ghostm/lift_blank_heroku
// to change Application to App
// Original version was modified based on the
// Scalatra Jetty Launcher
val port = if(System.getenv("PORT") != null) System.getenv("PORT").toInt else 8080
val server = new Server
val scc = new SelectChannelConnector
scc.setPort(port)
server.setConnectors(Array(scc))
val context = new ServletContextHandler(server, "/", ServletContextHandler.NO_SESSIONS)
context.addServlet(classOf[DefaultServlet], "/");
context.addFilter(classOf[LiftFilter], "/*", 0)
context.setResourceBase("src/main/webapp")
server.start
server.join
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment