views:

244

answers:

1

I've been looking at Groovy a little lately, and I love the idea of the Groovy Web Console.

I'm idly wondering whether there's a way to embed a simple web control to write and run scripts from in a web app I might put together myself.

  • Is there a plugin-style solution to embed a control like this?
  • Are there any resources or guidance out there to help in persisting source code?
+1  A: 

The Grails web framework has the Grails console which is basically a Groovy console that has access to your web app's state. More specifically, in the Grails console there are a bunch of predefined variables which you can use to access/change the web app at runtime. For example ctx is a predefined variable that provides access to the application's Spring beans (AKA ApplicationContext).

Normally the grails console runs as a desktop app, but there's a plugin available that will let you include it as part of the application itself, and therefore use it via a web browser.

Don
That does sound like the obvious way to do it. Does the plugin run the console in any sort of sandbox? Otherwise, it could be a security nightmare.
Matt Passell