Category: AEM

AEM Context-Aware Configurations in Java Backend Example Code

AEM Context-Aware Configurations to enable developers to define adaptable application settings based on specific site or content contexts. This feature significantly simplifies the management of environment-specific configurations, allowing for dynamic application behavior adjustment without changing the core application code. In this article, we will step through how developers can incorporate and retrieve context-aware configurations from […]

HTL caconfig Global Variable for Context-Aware Configuration in AEM

Context-Aware configuration contains a Scripting Binding Values provider with automatically registeres a caconfig variable in your HTL/Sightly scripts to directly access context-aware configurations. It supports both singleton configurations and configuration lists. Please note that configuration lists are only supported when configuration metadata is present (e.g. via an annotation class). In this article we will step […]

AuthenticationSupport service missing. Cannot authenticate request.

Encountering the “AuthenticationSupport service missing. Cannot authenticate request” OR the “HTTP ERROR 404 Not Found org.apache.felix.http.base.internal.dispatch.DispatcherServlet” errors in Adobe Experience Manager (AEM) can halt your development progress, presenting a significant obstacle. This error often points to underlying issues with the AEM instance’s ability to access or initialize critical repository services. Fortunately, there’s a practical approach […]

Handling Http Requests, HttpClient, in AEM

When integrating with external services or APIs from Adobe Experience Manager (AEM), utilizing the HttpClient for outbound HTTP requests is a common requirement. It’s crucial to handle these connections efficiently, securely, and in a way that is compatible with AEM’s architecture to ensure optimal performance and maintainability of your code. AEM provides a specialized factory, […]

AEM Chrome Extension for Content Authors, Developers, and CMS Admins Across All AEM Versions

Navigating Adobe Experience Manager (AEM) can often feel like a repetitive dance for content authors, developers, and administrators. Moving between pages, Touch UI editor, Classic UI editor, page properties, and CRXDE Lite involves the manual hassle of copying URLs and making adjustments – a time-consuming chore that needs a fresh approach. Enter the AEM Chrome […]

Execute JavaScript in the Author Environment for AEM Components AEM 6.5+

To execute JavaScript specifically for the AEM Author Environment, developers can add a condition to check for a Cookie stored in the browser, ‘cq-authoring-mode’; this works on AEM 6.5+. When the Cookie of ‘cq-authoring-mode’ exists, then execute JavaScript during authoring on the editor.html. Only in the Author Environment, the Cookie, ‘cq-authoring-mode’, will exist. Below is […]

Benefits of SlingSafeMethodsServlet with Code Examples

A robust security strategy is pivotal to safeguarding applications. As an AEM developer, we must really understand the SlingSafeMethodsServlet, an invaluable feature within the Apache Sling framework. This article explores the core concepts, practical benefits, and the heightened security it brings to servlet development. The org.apache.sling.api.servlets.SlingSafeMethodsServlet is an extension of the trusted HttpServlet in Apache […]

Try-With-Resources: Ensuring Session Closure, AEM Code Example

In the dynamic realm of Java programming in AEM, effective resource management is a cornerstone of writing robust and reliable code. The “try-with-resources” statement, introduced in Java 7, emerges as a powerful ally in simplifying resource handling. This article delves into the practical implementation of “Try-With-Resources” within the context of a specific code snippet, emphasizing […]

AEM Convert Excel to JSON Simple Servlet Example

In this article, I present a straightforward yet powerful solution that demonstrates how to seamlessly convert Excel data into JSON format using Adobe Experience Manager (AEM). By implementing a custom servlet, I will illustrate the process of converting an Excel sheet named ‘example.xlsx’ into structured JSON data; it can be downloaded below for you following […]

JCR SQL2 ISDESCENDANTNODE Multiple Paths Example

While working with the JCR SQL2 Queries, you may encounter scenarios where content is distributed across various branches of the repository. Querying these branches efficiently is key to implement features to capture requirements. In this article, we will focus o how to collect and query for distributed across various branches of the repository. Using the […]

Optimizing & Debugging Search Queries, Explain Query Tool AEM

The “Explain Query Tool” tool assists developers in understanding, optimizing, and debugging search queries, which are crucial for the AEM’s performance and accurate content delivery. Understanding the Explain Query Tool The Explain Query Tool essentially breaks down and explains the steps and processes a query goes through in AEM. Think of it as a ‘debug […]

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 […]

AEM 6.5 On-Prem, Embed AEM Core Component’s to the Project

The AEMaaCS platform contains the Adobe AEM Core Components pre-installed into the /libs folder, but however, AEM 6.5 on-prem does automatically contain this; we must install it manually. For legacy AEM 6.5 project utilizing the Adobe AEM Core Components, they must configure & install this library to each environment (authors, publishers) with the correct version. […]

How to Embed wcm.io Context-Aware Configuration Editor

This blog article serves as your guide to seamlessly integrate and deploy the wcm.io Context-Aware Configuration Editor – a powerful tool that streamlines configuration management within AEM projects. Throughout this article, we will delve into the step-by-step process of configuring, installing, embedding, and deploying the wcm.io Context-Aware Configuration Editor. By following these instructions, you’ll be […]

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 […]

Search in AEM

This comprehensive guide offers AEM developers like you a roadmap to implement powerful search functionality using AEM Search APIs. Unravel the potential of three core AEM Search APIs: XPath Search API, JCR SQL2 Search API, and Query Builder Search API. Each API brings unique features to the table, and we’ll guide you through their capabilities […]

50 Visual Studio | VS Code Hot Key / Shortcuts for Mac 2023

Welcome to our guide on 50 Visual Studio Code shortcuts for Mac users. Whether you’re a seasoned developer or just starting, mastering these keyboard shortcuts will significantly enhance your coding productivity. Let’s dive in and discover the most efficient key combinations for a seamless coding experience! For Window users, visit this article, 50 Visual Studio […]

50 Visual Studio | VS Code Hot Key / Shortcuts for Windows 2023

Welcome to our guide on 50 Visual Studio Code shortcuts for Windows users. Whether you’re a seasoned developer or just starting, mastering these keyboard shortcuts will significantly enhance your coding productivity. Let’s dive in and discover the most efficient key combinations for a seamless coding experience! For Mac users, visit this article, 50 Visual Studio […]

AEM Sightly Official Documentation: Everything You Need to Know

This blog particularly promotes Adobe’s AEM Sightly documentation, which lives inside of their github repository. In this article, we’ll explore the significance of AEM Sightly and how its official documentation can be a valuable resource for developers working with Adobe Experience Manager. With understanding Adobe’s Sightly documentation, you will be equipped with the right tools […]

A Simple Guide to AEM Search APIs: Exploring Your Options for Powerful Search Functionality

As an AEM developer, the ability and skill to identify solutions and implementations to quickly and efficiently search through vast amounts of content is crucial. Understanding the all the AEM platform’s search API capabilities will ensure you are a effective developer, when implementing solutions for AEM search. In this article, we will explore the various […]

Add inline CSS with AEM Sightly

AEM Sightly is a templating language that simplifies the integration of HTML and server-side logic. One of the key features of Sightly is the ability to use add inline-css to the component itself, so that your user experience requirements can be full-filed. In this article, we will explore how AEM Sightly enables developers to apply […]

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 […]

How to Enable AEM Style System Configuration for Components

AEM Style System enables a user-friendly interface, for non-technical users who can easily make style adjustments, fostering creativity and agility. Integrating seamlessly with Adobe Experience Manager, the AEM Style System enables content authors to apply predefined styles effortlessly, maintaining brand consistency across platforms and devices. As developers are trying to create new AEM component’s this […]

AEM Style System Component Information with Code Sling Models

As an AEM full-stack web developer who frequently works with AEM components, it’s not uncommon to require access to the AEM Style System configuration of a specific component. This information can prove invaluable when writing conditional algorithms to manipulate data output. However, the question remains: how can one retrieve the necessary AEM Style System information […]

Set AEM Local Environment and Secret Variables AEMaaCS

As an AEM developer developing for the AEMaaCS SDK, it’s essential to have a local environment properly set up for development purposes. You may encounter environment-specific and secret variables in your OSGI configuration files. As an AEM developer trying to familiarize new features of the AEMaaCS SDK development environment, setting up environment-specific and secret variables […]

How to login to AEMaaCS Local Publish crx/de system/console

As an AEM developer working in the AEMaaCS environment, it’s common to need to run AEMaaCS local author and publish while developing in your local environment. Typically, authenticating into the AEMaaCS local author environment is straightforward, but accessing the AEMaaCS local publish environment requires some additional steps. The AEMaaCS local publish environment runs on port […]

JUNIT5: What Exactly is org.mockito.junit.jupiter.MockitoExtension and Sling Model Example

org.mockito.junit.jupiter.MockitoExtension is a JUnit 5 extension provided by the Mockito library. It allows you to use the Mockito framework to create and inject mocked objects into your JUnit 5 test classes. This extension provides several features such as annotation-based mock creation, automatic detection of unused stubs, and support for the Mockito API. It enables you […]

AEM JUNIT5 with io.wcm.testing.mock.aem.junit5.AemContextExtension

io.wcm.testing.mock.aem.junit5.AemContextExtension is an extension for JUnit 5 that provides a way to run AEM (Adobe Experience Manager) unit tests with mocked AEM objects. This extension allows you to set up an AemContext object in your JUnit 5 test class, which provides access to mocked AEM objects such as the ResourceResolver, SlingSettings, and more. This makes […]

error: immutable file ‘conf.d/dispatcher_vhost.conf’ has been changed!

While setting up Adobe Experience Manager (AEM) as a Cloud Service’s dispatcher SDK on my local Mac machine, following this Adobe documentation, I encountered an error while running the command “./bin/validate.sh src”. The error message read “error: immutable file ‘conf.d/dispatcher_vhost.conf’ has been changed!”. After some research, I found that the issue was related to the […]

AEM Programmatically Write/Update/Modify AEM JCR node property/properties

In this article, I will be presenting code snippets for how we can programmatically update AEM JCR nodes in AEM using Java; using the org.apache.sling.api.resource.ModifiableValueMap and javax.jcr.Node API. In this article, we are showcasing the way that you would programmatically update AEM JCR nodes in your local machine, logged in as a System Users in […]

resourceResolverFactory.getAdministrativeResourceResolver(null) WhiteList Bundle for Administrative Login

When working for organizations with the goal of migrating from AEM 6X to 6.5 or to AEM Cloud as a Service. It’s very common that the AEM backend code still utilizes the deprecated resourceResolverFactory.getAdministrativeResourceResolver(null) @depricated API. This method has been deprecated as of 2.4 (bundle version 2.5.0) because of inherent security issues. Services requiring specific […]

Race Conditions with window.Granite?.I18n

We have created a JavaScript micro-frontend in VueJS to handle a new feature for our website. The JavaScript micro-frontend is set up nicely inside of a maven module. Along with it’s own Node Package Manager configuration, we used the aem-clientlib-generator to generate a client library under /apps/sourcedcode/clientlibs/micro-frontend. Within our VueJS application, we have a utility […]

What are AEM ExtraClientlibs?

When dealing with cq:ClientLibraryFolder (node type), you may have come across a property called extraClientlibs. What are extraClientlibs and how does it work? As you may recall, when you want to add custom functionality or styling to the Touch Dialogues (in edit author mode, editor.html), we must include cq.authoring.editor.sites.page as a dependency and cq.authoring.editor.sites.page.hook as […]

AEM Granite UI Coral 3 Number Field Default Value

This article is for how can we set the default positive or negative integer value for the Granite UI 1.0 Coral 3 numberfield, granite/ui/components/coral/foundation/form/numberfield. Apparently the Granite UI 1.0 documentation for the granite/ui/components/coral/foundation/form/numberfield, does not support default value configuration for the numberfield. Keep reading… I mean, they do… you can set a default value for […]

Importing rep:policy nodes in the ui.content maven content package

While working on a new AEM project (typically using https://github.com/adobe/aem-project-archetype), we might sometimes want to deploy new content with rep:policy nodes in particular, to give permission controls to allow jcr:read everyone to view the root content pages like /content/sourcedcode. There comes when a problem while building the ui.content maven module. Sometimes the rep:policy node is […]

AEM Client Library Debugger & Client Library Test Tool

A quick way to validate your AEM client libraries via registered clientlib categories is by using the AEM, out-of-the-box, “AEM Client Library Debugger Test Tool”. The tool is very bareboned. When you are on the tool page, you’ll find a Categories input field. Simply insert your to-be-tested clientlib category value here and press “submit”. Your […]

Get Cookie Example of AEM Servlet and Sling Model

In this short article, we will show two code examples; for example, one will be showcasing how cookies values can be accessed for an AEM Servlet, and for example two, Sling Model. 1. AEM Servlet Get Cookie Example 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465package com.sourcedcode.core.servlet; import com.cat.wcm.core.util.JSONObject; import org.apache.commons.lang.StringUtils; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.SlingHttpServletResponse; import org.apache.sling.api.servlets.SlingAllMethodsServlet; import org.osgi.service.component.annotations.Component; import javax.servlet.Servlet; import […]

Set Cookie Example of AEM Servlet and Sling Model

In this short article, we will show two code examples; for example, one will be showcasing how cookies values can be set for an AEM Servlet, and for example two, Sling Model. 1. AEM Servlet Set Cookie Example 12345678910111213141516171819202122232425262728293031323334353637package com.sourcedcode.core.servlets; import com.cat.wcm.core.util.JSONObject; import org.apache.sling.api.SlingHttpServletRequest; import org.apache.sling.api.SlingHttpServletResponse; import org.apache.sling.api.servlets.SlingAllMethodsServlet; import org.osgi.service.component.annotations.Component; import javax.servlet.Servlet; import javax.servlet.http.Cookie; import […]

How to Dynamically Include an Experience Fragment in Sightly

In this article, we will dynamically reference an AEM experience fragment to a page, dynamically using code. Sightly Implementation Hard Coded Example The first example uses sightly to reference an experience fragment, /content/experience-fragments/we-retail/equipment, and the required variation, master. This will only work when the path includes the experience fragment variation path. The value here is […]

AEM IntelliJ Debug Error:osgi: [sourcedcode.core] Classes found in the wrong directory: {META-INF/versions/9/javax/xml/bind/ModuleUtil.class=javax.xml.bind.ModuleUtil}

Writing unit tests for AEM Backend code on IntelliJ can sometimes be challenging; mocking objects, initializing OSGI components, etc… It’s most beneficial when we can write unit tests utilizing the JUnit debug feature on IntelliJ. While trying to debug code in JUnit, I was getting an error of 1Error:osgi: [sourcedcode.core] Classes found in the wrong […]

ACS Commons multi-field extension, acs-commons-nested, checkbox is not working

This article will provide a solution to the ACS Commons multi-field extension, checkbox Granite UI Component. While utilizing the ACS Commons multi-field extension, for everything I tried, I am not able to get the checkbox Granite UI component working as expected. Not an elegant way to solve the problem, but something that actually works and […]

How to Pass Data Parameters to WCMUsePojo from Sightly HTL Component

You can pass data parameters from Sightly HTL component to the WCMUsePojo backend in a very simple way. You can simply call the get(String name, Class type) method from the available public methods from the com.adobe.cq.sightly.WCMUsePojo class. For implementation, use the get(String name, Class type) method, we obtain the values sent from Sightly as attributes; […]

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 […]

Back To Top