sling

Determine runmode in Adobe CQ

痴心易碎 提交于 2019-11-30 14:50:05
问题 How do I programmatically know which run-mode the instance is running? I created a custom tag that provides the config depending on the instance run-mode, but I can not determine the current run-mode. I found a method that returns a list of run-mods instance: SlingSettings settings = ...get from BundleContext... Set<String> currentRunModes = settings.getRunModes(); But I can not get the objects SlingSettings or BundleContext. How can I get these objects or perhaps there is another way to get

What is the purpose behind building of Apache Sling, Felix, Jackrabbit projects

╄→尐↘猪︶ㄣ 提交于 2019-11-30 04:49:32
I am asking a very basic question here. Question is I am using Apache Sling , Apache Jackrabbit, Apache Felix in my project as said by my instructor. I am trying to understand why these software is developed by Apache. I tried a lot on the internet,, but I didn't find any blog or wordpress blog, or any useful youtube video that explain all these projects. Can you explain me about these projects. Why these projects developed? What they do ? and more questions like this Previously I found the same doubt with Apache Hadoop, but all the material that I found on net is sufficient for me to get a

How to set a resource property

夙愿已清 提交于 2019-11-30 01:51:52
问题 I have a Sling Resource object. What is the best way to set or update its property? 回答1: It depends on the Sling version: Sling >= 2.3.0 (since CQ 5.6) Adapt your resource to ModifiableValueMap, use its put method and commit the resource resolver: ModifiableValueMap map = resource.adaptTo(ModifiableValueMap.class); map.put("property", "value"); resource.getResourceResolver().commit(); Sling < 2.3.0 (CQ 5.5 and earlier) Adapt your resource to PersistableValueMap, use its put and save methods:

Unable to deploy SlingServlet in CQ

荒凉一梦 提交于 2019-11-28 14:01:16
I'm trying to create a servlet in CQ to access some back-end services. Then from my page will make an AJAX call to get the response from servlet. @Component(immediate = true, metatype = false, label = "feedServlet") @Service(Servlet.class) @Properties(value = { @org.apache.felix.scr.annotations.Property(name = "sling.servlet.methods", value = "POST"), @org.apache.felix.scr.annotations.Property(name = "sling.servlet.resourceTypes", value ="/bin/feedServlet/"), @org.apache.felix.scr.annotations.Property(name = "sling.servlet.selectors", value ="POST"), @org.apache.felix.scr.annotations.Property

How to convert HTTP Request Body into JSON Object in Java

痞子三分冷 提交于 2019-11-27 03:23:03
问题 I am trying find a Java lib/api that will allow me to turn the contents of a HTTP Request POST body into a JSON object. Ideally I would like to use a Apache Sling library (as they are exposed in my container naturally). The closest I've found it: org.apache.sling.commons.json.http which converts the header to JSON. HTTP Post bodies are in the format; key1=value1&key2=value2&..&keyn=valueN so I assume there is something out there, but I havent been able to find it. I may just have to use a

How to use/understand AEM Sling Resource Merger, override and Overlay concepts

微笑、不失礼 提交于 2019-11-27 03:05:37
问题 Am trying to understand the AEM Sling Resource Merger concept. As per the Adobe docs examples Override (Configuring your Page Properties), Overlay (Customizing the Consoles (touch-optimized UI)) am getting confused how to use this, can any one explain with simple component to understand it in more better way. 回答1: Here you go with an explanation Overlay: When you overlay a component in AEM means that copy component from /libs/ folder to /apps/.. folder. And you can impose your own definitions

ResourceResolverFactory getServiceResourceResolver throws Exception in AEM 6.1

走远了吗. 提交于 2019-11-26 22:53:39
I want to write some data to AEM, and the below code works fine for me in AEM 6.0 but not in AEM 6.1 , always throws a Login Exception as follows: " Login Exception when obtaining a CRX User for the Service:'writeService'.org.apache.sling.api.resource.LoginException: Cannot derive user name for bundle group.tti.commons-service [395] and sub service writeService " OSGI Config: Code in my class: import javax.jcr.Session; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceResolverFactory; .... @Reference private ResourceResolverFactory factory;

ResourceResolverFactory getServiceResourceResolver throws Exception in AEM 6.1

自古美人都是妖i 提交于 2019-11-26 08:27:48
问题 I want to write some data to AEM, and the below code works fine for me in AEM 6.0 but not in AEM 6.1 , always throws a Login Exception as follows: \" Login Exception when obtaining a CRX User for the Service:\'writeService\'.org.apache.sling.api.resource.LoginException: Cannot derive user name for bundle group.tti.commons-service [395] and sub service writeService \" OSGI Config: Code in my class: import javax.jcr.Session; import org.apache.sling.api.resource.ResourceResolver; import org