AEM 6.1 Touch UI | Populating Drop Down | Fetching resourceType of the actual component in datasource
Hi,
Can anyone please let me know how we can read the calling component ResourceType in the datasource.jsp.
Requirement is to populate the dropdown in Touch UI mode . For which I created a datasource and invoking my custom osgi service. Till this it works and service is getting invoked. But when I do "resource.getResourceType()" as highlighted below. It returns me "/apps/mywebsite/components/datasource" path. But I want the resourceType for the calling component which is "/apps/mywebsite2/components/herotext2".
Please let me know how we I can read the resourceType for herotext2 in datasource.jsp.
//INVOKE A BACKEND OSGI Service com.sapient.platform.iea.aem.core.accessors.api.HelloService mySource = sling.getService(com.sapient.platform.iea.aem.core.accessors.api.HelloService.class) ; // String osgiValue = mySource.getData1(); Map<String, String> optionMap = new HashMap<String, String>(); optionMap = mySource.getData(resource.getResourceType()); String Text=""; for (Map.Entry<String, String> entry : optionMap.entrySet()) { String value= entry.getKey(); String text= entry.getValue(); vm = new ValueMapDecorator(new HashMap<String, Object>()); vm.put("value",value); vm.put("text",text); fakeResourceList.add(new ValueMapResource(resolver, new ResourceMetadata(), "nt:unstructured", vm)); }