Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also allow execution of Groovy in the JS component #115

Open
Vampire opened this issue Mar 11, 2021 · 0 comments
Open

Also allow execution of Groovy in the JS component #115

Vampire opened this issue Mar 11, 2021 · 0 comments

Comments

@Vampire
Copy link

Vampire commented Mar 11, 2021

I know this is Kotlin playground.
But I thought I'd ask for this anyway as almost everything is in place already anyway,
so integrating this should not be a big deal.

For Groovy there is the Groovy web console at http://groovyconsole.appspot.com/ where you can execute code like on play.kotl.in.
If this is slightly modified to set CORS headers to allow other sites to call executor.groovy like it could be done on the http://meetspock.appspot.com/ fork, the remote execution possibility is given already:

$ curl "http://groovyconsole.appspot.com/executor.groovy" --data-raw "script=println 'FOO'"
{"executionResult":"null","outputText":"FOO\n","stacktraceText":""}
$ curl "http://groovyconsole.appspot.com/executor.groovy" --data-raw "script=println 'FOO"
{"executionResult":"","outputText":"","stacktraceText":"expecting ''', found '<EOF>' @ line 1, column 13.\n   println 'FOO\n               ^\n\n1 error\n"}
$ curl "http://groovyconsole.appspot.com/executor.groovy" --data-raw "script='FOO'"
{"executionResult":"FOO","outputText":"","stacktraceText":""}

And on the side of this JS component also everything is almost in place already.
If you change the if that says that everything non-kotlin is read-only and use a different request and response processing for Groovy it basically works already.

I gave it a very quick try and was able to have something that works in the happy path, but I'm not a trained JS dev these days, so I'm not going to do a full implementation for this. But for a trained JS dev this should be a pretty quick task and it would be really amazing if this could be added. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant