| 1 |
import org.mortbay.jetty.Server |
| 2 |
import org.mortbay.jetty.servlet.* |
| 3 |
import groovy.servlet.* |
| 4 |
|
| 5 |
@Grab(group='org.mortbay.jetty', module='jetty-embedded', version='6.1.14') |
| 6 |
def startJetty() { |
| 7 |
def jetty = new Server(9090) |
| 8 |
def context = new Context(jetty, '/', Context.SESSIONS) |
| 9 |
context.setWelcomeFiles(["webserverIndex.groovy"] as String[]) |
| 10 |
context.resourceBase = '.' |
| 11 |
context.addServlet(GroovyServlet, '*.groovy') |
| 12 |
jetty.start() |
| 13 |
} |
| 14 |
|
| 15 |
println "Starting Jetty on port 9090, press Ctrl+C to stop." |
| 16 |
startJetty() |
| 17 |
|
| 18 |
// From https://gist.github.com/saltnlight5/3756240 |
| 19 |
|