All Downloads are FREE. Search and download functionalities are using the official Maven repository.

be.orbinson.aem.groovy.console.servlets.ScriptSavingServlet.groovy Maven / Gradle / Ivy

There is a newer version: 19.0.8
Show newest version
package be.orbinson.aem.groovy.console.servlets


import be.orbinson.aem.groovy.console.GroovyConsoleService
import be.orbinson.aem.groovy.console.api.context.impl.RequestScriptData
import org.apache.sling.api.SlingHttpServletRequest
import org.apache.sling.api.SlingHttpServletResponse
import org.osgi.service.component.annotations.Component
import org.osgi.service.component.annotations.Reference

import javax.servlet.Servlet
import javax.servlet.ServletException

@Component(service = Servlet, immediate = true, property = [
        "sling.servlet.paths=/bin/groovyconsole/save"
])
class ScriptSavingServlet extends AbstractJsonResponseServlet {

    @Reference
    private GroovyConsoleService consoleService

    @Override
    protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws
            ServletException, IOException {
        def scriptData = new RequestScriptData(request)

        writeJsonResponse(response, consoleService.saveScript(scriptData))
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy