com.icfolson.aem.groovy.console.servlets.ScriptSavingServlet.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aem-groovy-console Show documentation
Show all versions of aem-groovy-console Show documentation
The AEM Groovy Console provides an interface for running Groovy scripts in the AEM container. Scripts can be
created to manipulate content in the JCR, call OSGi services, or execute arbitrary code using the AEM, Sling,
or JCR APIs.
package com.icfolson.aem.groovy.console.servlets
import com.icfolson.aem.groovy.console.GroovyConsoleService
import org.apache.felix.scr.annotations.Reference
import org.apache.felix.scr.annotations.sling.SlingServlet
import org.apache.sling.api.SlingHttpServletRequest
import org.apache.sling.api.SlingHttpServletResponse
import javax.servlet.ServletException
@SlingServlet(paths = "/bin/groovyconsole/save")
class ScriptSavingServlet extends AbstractJsonResponseServlet {
@Reference
private GroovyConsoleService consoleService
@Override
protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws
ServletException, IOException {
writeJsonResponse(response, consoleService.saveScript(request))
}
}