Retrieving the Current Page in an AEM Servlet via ResourceType
In the context of “Retrieving the Current Page in an AEM Servlet via ResourceType”, it is great to understand how this is done. This guide provides a simplified walkthrough on how you can adeptly achieve this. In the code example, we will associating the servlet with a resourceType. 123456789101112131415161718192021222324252627282930313233343536373839package com.example.aem.servlets; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.SlingHttpServletResponse; import […]
How to access Design Dialogue Properties in Sling Model
Design Dialogs are especially useful for creating components that need to be easily configurable through editable template and policies without directly editing the underlying code. They enable a clear separation between content and presentation, allowing content authors to make changes without needing technical expertise. Design Dialogs are defined using the AEM Touch UI Dialog, which […]
AEM Rich Text Editor rendering aria-labels
You have written some custom JavaScript for the AEM Core Text Component, core/wcm/components/text/v2/text, which allows content producers to configure the HTML attribute “aria-label” to anchor “a” tags. When the page is being rendered on the page, the “aria-label” for the links, “a” tags, are not visible. You as a developer check crx/de and you do […]
AEM Query Builder Examples with Content Fragments
In this article, I will share some example AEM Query Builder API Search Queries that queries for Content Fragments. 1. Find all Content Fragments with Content Fragment Model 123456type=dam:Asset path=/content/dam/sourcedcode boolproperty=jcr:content/contentFragment boolproperty.value=true property=jcr:content/data/cq:model property.value=/conf/sourcedcode/settings/dam/cfm/models/model1 http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&query=type%3Ddam%3AAsset%0D%0Apath%3D%2Fcontent%2Fdam%0D%0Aboolproperty%3Djcr%3Acontent%2FcontentFragment%0D%0Aboolproperty.value%3Dtrue%0D%0Aproperty%3Djcr%3Acontent%2Fdata%2Fcq%3Amodel%0D%0Aproperty.value%3D%2Fconf%2Fsourcedcode%2Fsettings%2Fdam%2Fcfm%2Fmodels%2Fmodel1 2. Find all Content Fragments with Content Fragment Model & Property 12345678type=dam:Asset path=/content/dam/sourcedcode boolproperty=jcr:content/contentFragment boolproperty.value=true 1_property=jcr:content/data/cq:model 1_property_1.value=/conf/sourcedcode/settings/dam/cfm/models/model1 2_property=jcr:content/data/master/title 2_property.value=example http://localhost:4502/libs/cq/search/content/querydebug.html?_charset_=UTF-8&query=path%3D%2Fcontent%2Fdam%2Fsourcedcode%0D%0Aboolproperty%3Djcr%3Acontent%2FcontentFragment%0D%0Aboolproperty.value%3Dtrue%0D%0A1_property%3Djcr%3Acontent%2Fdata%2Fcq%3Amodel%0D%0A1_property_1.value%3D%2Fconf%2Fsourcedcode%2Fsettings%2Fdam%2Fcfm%2Fmodels%2Fmodel1%0D%0A2_property%3Djcr%3Acontent%2Fdata%2Fmaster%2Ftitle%0D%0A2_property.value%3Dexample […]
@SlingServletPaths Example Code in AEM
This is a quick reference to example code, which will show you how to use the most base instantiation of @SlingServletPaths. The output is a simple JSON response with application/JSON, 200 OK, and response body = { “property1”: “value1” }. Quick note: it’s not recommended to use @SlingServletPaths. Check out the caveats when implementing servlets […]
AEM Touch UI (Granite UI) Tabs: Example Code
Almost all components require developers to put together the Touch UI experience with tabs as the base of their components. It’s a simple XML code configuration, however, sometimes finding the reference isn’t that easy to find online. This article is just a simple reference article where I share the configuration as XML, so it can […]
How to Pass Data Parameters to Sling Modal from Sightly HTL Component
You can pass data parameters from Sightly HTL component to the Sling Model backend by request attributes. For implementation, utilising the org.apache.sling.models.annotations.Model, we will add required options parameter, adaptable, with the value of SlingHttpServletRequest.class. Next, we can utilize the annotation, org.apache.sling.models.annotations.injectorspecific.RequestAttribute (@RequestAttribute), which will find the matching name of the attribute that is being passed […]
AEM inheritedpageproperties with Sightly, JSP, OSGI Bundle
inheritedpageproperties helps you retrieve a parent property from parent pages. Inherited page properties utilises com.day.cq.commons.inherit.HierarchyNodeInheritanceValueMap, where the search is made on the page hierarchy, upwards; searching children of the page nodes (components) are not included. Inherited page properties can be retrieved in multiple ways, where this article will only focus on 3 ways. In this […]
How many times is an AEM Component used in the JCR?
Can we detect and remove unused components from our codebase? Is this AEM component being used at all? How many times is my component used within my running AEM instance? These are the common questions we have when we are trying to figure out the number of use and the node-paths of the targeted searched […]
OSGI R6 Configuration @AttributeDefinition Essentials Reference Guide
When defining any OSGI component’s configuration its standard practice to use Declarative Services; these configurations can be edited in the OSGI Apache Felix Console. This can be done by creating a class interface with the annotated @ObjectClassDefinition, which includes a determined list of rules as @AttributeDefinition items. The @AttributeDefinition defines the supporting configuration for a […]
Articles List View
Articles List View This is a list view of all the popular articles on sourcedcode.com to help you navigate to your needs quicker. I hope this will page will help you find what you need, faster and more efficient! OSGI OSGI R6 Configuration @AttributeDefinition Essentials Reference Guide How to Enable Configuration for OSGI Components with […]
AEM Granite UI 1.0 Form Component’s XML Cheat Sheet Reference Guide
This AEM Granite UI 1.0 Form Component’s XML Reference Guide provides code snippets to help developers speed up their AEM Touch UI development. This quick reference includes the most used Granite UI form components with plug and plays XML examples. Note: If you want to understand how to convert Granite UI 1.0 Form Components from […]
AEM Sling Model Injectors Annotations Cheat Sheet Reference Guide
The Apache Sling Model enables injector specific annotations which aggregate the standard annotations for each of the available injector, which are: Script Bindings, Value Map, Resource Path, Child Resources, Request Attributes, OSGI Services, Self, and the Sling Object. Sure we can invoke injectors by the @inject, followed by the @source annotation (with an injector name) […]
AEM Global Objects for Backend and Front-end Sightly (HTL) Development
While working on an AEM project, we can speed up the process of development by utilizing the global objects offered by AEM Framework. Quick Links Backend Example Front-end Examples Sightly/HTL & AEM Backend Objects Mapping 1. AEM Backend, an example of using global objects The global objects are accessible by OSGI’s dependency injection annotation; @inject. […]
How to use AEM JCR SQL2 query strings to query for nodes in Java Content Repository
JCR-SQL2 (Java Content Repository – Structured Query Language 2) is domain specific language used to query JCR nodes held in the JCR repository. The syntax for JCR-SQL2 is fairly similar to SQL, so if you have some experience with SQL, this tutorial will be a walk in the park for you. The best way to […]
What is the AEM Apache Sling Referrer Filter OSGI configuration?
AEM “referrer not allowed” Out of the box, AEM denies all server names or hosts to make HTTP request to the respective running AEM publish/author instance. During a HTTP request made to the AEM publish/author, AEM checks the Referrer header configuration. If the referrer configured to allow the host(s), then AEM will full-fill the request, […]