Skip to content

Instantly share code, notes, and snippets.

@c3ry5
c3ry5 / aem.cq.getRequest.js
Last active March 15, 2023 04:39
Get request using the AEM sightly Javascript use api
"use strict";
use(function() {
var url = this.api,
getRequest = new org.apache.commons.httpclient.methods.GetMethod(url),
client = new org.apache.commons.httpclient.HttpClient(),
status = new org.apache.commons.httpclient.HttpStatus(),
inputStream;
console.log("Retrieving data from " + url);
try {
var statusCode = client.executeMethod(getRequest);