简体   繁体   中英

Dynamic Groovy Uploaded to Grails Application

Yes, we're aware of all the security risks that come with the ability to upload code into a production system by users, but for the sake of this question let's pretend it doesn't matter.

In a Grails application being developed we need to allow the user to upload some Groovy code that will be used by the Grails application as well as a CLI that our customers will download and use.

I am aware of the following documentation regarding embedding Groovy.

Is there a better alternative than embedding and interpreting on the fly? Or is this pretty much it?

Depends on what you mean by embedding Groovy. The console plugin provides a fairly nice way of adding running code on the fly with access to the grails context and domain classes. http://grails.org/plugin/console . If you look into the code, it wouldn't be very hard to simply store scripts in your database as strings and use the script execution mechanism provided by the plugin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM