Tiny WebContainer/Server

/ Published in: Groovy
Save to your folder(s)

Copy this code and paste it in your HTML
  1. //Needs both jetty.jar and jett-util.jar
  2. import org.mortbay.jetty.*
  3. import org.mortbay.jetty.servlet.*
  4. import groovy.servlet.*
  6. def server = new Server(8080)
  7. def root = new Context(server,"/",Context.SESSIONS)
  8. root.setResourceBase(".")
  9. root.addServlet(new ServletHolder(new TemplateServlet()), "*.html")
  10. server.start()

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.