}
@Override
protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException,
IOException {
XSSAPI xssAPI = request.adaptTo(XSSAPI.class);
try {
JSONObject result = new JSONObject();
JSONArray list = new JSONArray();
result.put("list", list);
ServiceReference[] services = tracker.getServiceReferences();
if (services != null) {
for (ServiceReference service : services) {
String displayName = PropertiesUtil.toString(service.getProperty("displayName"), null);
String[] schemes = PropertiesUtil.toStringArray(service.getProperty(Importer.SCHEME_PROPERTY));
if (displayName != null && schemes != null) {
for (String scheme : schemes) {
JSONObject obj = new JSONObject();
obj.put("qtip", "");
obj.put("text", displayName);
obj.put("text_xss", xssAPI.encodeForJSString(displayName));
obj.put("value", scheme);
list.put(obj);
}
}
}