On Tue, Jul 12, 2016 at 3:16 PM, Robert Munteanu <romb...@apache.org> wrote: > ...How do you see this code snippet deployed in a Sling instance - is this > a regular script deployed under /libs|/apps or something else?...
I first thought we'd need a new flavor of the Groovy engine for this, but it's probably not necessary. See [1] for an example that works out of the box as a .groovy script. That example shows that simple Groovy-friendly wrappers that make the current Sling Resource more "navigable" can be useful, but we might just implement those via a BindingsValuesProvider, and end up with a .groovy script like def mimeTypes = sling.getService(org.apache.sling.commons.mime.MimeTypeService.class) builder . "${resource.name}" { date new java.util.Date() "mime-type" mimeTypes.getMimeType(request.requestPathInfo.extension) title resource.props.title description resource.props.description } -Bertrand [1] https://gist.githubusercontent.com/bdelacretaz/dc0a0ec4fada97fa2151bf3b74aa4788