com.citytechinc.aem.groovy.console.servlets.AbstractJsonResponseServlet.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 (Adobe CQ) 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.citytechinc.aem.groovy.console.servlets
import groovy.json.JsonBuilder
import org.apache.sling.api.SlingHttpServletResponse
import org.apache.sling.api.servlets.SlingAllMethodsServlet
abstract class AbstractJsonResponseServlet extends SlingAllMethodsServlet {
static void writeJsonResponse(SlingHttpServletResponse response, json) {
response.contentType = "application/json"
response.characterEncoding = "UTF-8"
new JsonBuilder(json).writeTo(response.writer)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy