Help embedding lift in jetty
Hello - newbie to scala and (esp) lift.
I'm trying to get lift embedded into a server I wrote which also embeds jetty, so trying to avoid making war files, etc (the init code is at the end of this email) and thought someone out there might be able to point me in the right direction. I am using lift-util-1.0.jar and lift-webkit-1.0.jar, a bunch of the jetty jars, and any other jars needed to resolve dependencies. I may be a sucker for punishment, but everything works fine - the LiftServlet and LiftFilter are installed into jetty, and when I surf to :
http://localhost:8081/lift/
I get a 'broken link' error response to the browser, and the scala console outputs:
scala> INFO - Service request (GET) /lift/ took 136 Milliseconds
So, it looks like it's getting to lift, but likely lift thinks that there are no web apps, and hence the error (or something).
I have a directory containing a simple hello world lift app created with maven archetype:generate, and I'd like to point the LiftServlet to that, if at all possible. Or copy that project structure somewhere underneath jetty...
I've tried copying the lift app to cwd, the classes directory, the lib directory, etc to no avail.
Does anyone know how to get the LiftServlet to find the web apps?
Any help is appreciated.
brian...
--- x8 snip
import com.whatevernot.liaison.servlet.HelloServlet
import net.liftweb.http._
import org.eclipse.jetty.server._
import org.eclipse.jetty.servlet._
val server = new Server(8081)
val context = new ServletContextHandler(ServletContextHandler.SESSIONS)
context.addFilter(new FilterHolder(new LiftFilter()), "/lift/*", 1)
context.addServlet(new ServletHolder(new HelloServlet()), "/hello/*")
context.addServlet(new ServletHolder(new LiftServlet()), "/lift/*")
context.setContextPath("/")
server.setHandler(context)
server.start
I'm trying to get lift embedded into a server I wrote which also embeds jetty, so trying to avoid making war files, etc (the init code is at the end of this email) and thought someone out there might be able to point me in the right direction. I am using lift-util-1.0.jar and lift-webkit-1.0.jar, a bunch of the jetty jars, and any other jars needed to resolve dependencies. I may be a sucker for punishment, but everything works fine - the LiftServlet and LiftFilter are installed into jetty, and when I surf to :
http://localhost:8081/lift/
I get a 'broken link' error response to the browser, and the scala console outputs:
scala> INFO - Service request (GET) /lift/ took 136 Milliseconds
So, it looks like it's getting to lift, but likely lift thinks that there are no web apps, and hence the error (or something).
I have a directory containing a simple hello world lift app created with maven archetype:generate, and I'd like to point the LiftServlet to that, if at all possible. Or copy that project structure somewhere underneath jetty...
I've tried copying the lift app to cwd, the classes directory, the lib directory, etc to no avail.
Does anyone know how to get the LiftServlet to find the web apps?
Any help is appreciated.
brian...
--- x8 snip
import com.whatevernot.liaison.servlet.HelloServlet
import net.liftweb.http._
import org.eclipse.jetty.server._
import org.eclipse.jetty.servlet._
val server = new Server(8081)
val context = new ServletContextHandler(ServletContextHandler.SESSIONS)
context.addFilter(new FilterHolder(new LiftFilter()), "/lift/*", 1)
context.addServlet(new ServletHolder(new HelloServlet()), "/hello/*")
context.addServlet(new ServletHolder(new LiftServlet()), "/lift/*")
context.setContextPath("/")
server.setHandler(context)
server.start
Leave a comment