Reputation: 13471
I´m trying to use ratpack groovy framework from Java, but I cannot find a way to init from Java.
Any idea how to start up a ratpack.groovy script from Java?
This is my ratpack script
ratpack {
def tokens=[:]
serverConfig {
port 9000
}
handlers {
get("identity/:token") {
def token= pathTokens["token"]
render tokens[token]
}
}
}
Regards.
Upvotes: 0
Views: 183
Reputation: 2282
Based on GroovyRatpackMain, you can start a Groovy app from Java like this:
import ratpack.server.RatpackServer;
RatpackServer.start(Groovy.Script.appWithArgs(args));
If you need to use a non-default script file or perform other customization, Groovy.Script has methods to support that.
Upvotes: 2