Category: AEM

Structural Static Assets in AEM as Client Library Resources

As developers, when we are building components or view logic, in typical scenarios require assets like background image patterns, icons, logos, typography, etc.. These assets are considered as structural assets. Structural assets are assets that support CSS styles or JavaScript view logic; which are also static assets. Structural assets should be stored and managed within […]

How to Enable Configuration for OSGI Components with R6

Adding configuration to OSGi Component(s) is as simple as annotating your class with @Designate(ocd=””) annotation with the “ocd” property, and to make the @Activate method accepts an config param; as indicated below: 1234567891011121314// /com/sourcedcode/services/impl/ import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; import org.osgi.service.metatype.annotations.Designate; @Component(service = MyService.class, immediate = true) @Designate(ocd = SourcedCodeSiteSettingsConfig.class) public class MyserviceImpl extends MyService { […]

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 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 Sling Model Field Injection vs Constructor Injection Memory Consumption

Article was last updated on June 7th, 2020. Sling Models field injectors are used to support injection of AEM Library-specific context objects. For example, @ScriptVariable SightlyWCMMode will inject the WCMMode object, @ScriptVariable Resource will inject the current resource object, and @ScriptVariable Style will inject the Style object. These objects are typically stored within the object, […]

AEM Sling Model Injectors Annotations 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) […]

JUnit 4: AEM Sling Servlet Unit Test Example Using AEM Mocks, Servlet by Resource Type

This article will demonstrate how to write AEM Unit tests for @SlingServletResourceTypes (OSGi DS 1.4 (R7) component property type annotations) using the Junit4 testing framework. With developers being more visual, the source code is posted below. Technologies here used are: AEM project archetype 19 (link) Mockito 2.27.0 (link) AEM Mocks JUnit 4 2.7.2 (link) This […]

Registering @SlingServletPaths Component Property Type

You are probably looking for the @SlingServletPaths, OSGi DS 1.4 (R7) component property type annotations for Sling Servlets, code/unit test examples and was not successful. Apache recommends not use the @SlingServletPaths annotation, Sling Servlet register by a path. Rather to use the @SlingServletResourceTypes component type. Given the drawbacks in the caveats below, it is strongly […]

Sugar Coat Registered AEM Servlet Scripts and Paths Endpoint

In AEM we tend to write Sling Servlet OSGI Services to expose JSON data using the various service reference properties such as “sling.servlet.paths”, “sling.servlet.resourceTypes”, “sling.servlet.selectors”, and “sling.servlet.extensions”. Example 1: DirectoriesServlet.Java doGet Servlet Implementation (html extension): This is an example how a servlet in AEM to retrieve the directories JSON data. 1234567891011121314151617// example for /content/mysite.directories.html @SlingServlet( […]

What is a Servlet in AEM?

What is a Servlet? A Servlet is a class used to extend capabilities of servers that host applications accessed by means of a request-response programming model; we know most the HTTP protocol. In AEM, Servlets are typically registered as an OSGI service. The reference of the “sling.servlet.paths” or “sling.servlet.resourceTypes” must be set, or the Servlet […]

Improve Performance of AEM Components During Development Phase

Web performance is how quick web pages are successfully downloaded and viewable on the visitor’s browser. When we say “Web Performance Optimization”, this means that we are optimising or increasing web performance. Quicker download speeds of websites, in general, have shown in user contentment, retention, and loyalty. Especially with AEM enterprise websites, our motive is […]

Scenario: Building AEM Components with 3rd Party Integrations in a High Performance and Scalable Way

we are assigned to build a hospital search component in a very high traffic website. This hospital search component allows users to search for available hospital private rooms across the United States; there are approximately 200,000 hospital private rooms across the US.  The hospital search component, presented in the view, simply has an input field […]

AEM Project, WCMUsePojo “aQute.bnd.annotation.ConsumerType not found” (fix)

On rare occasions, when developing a Java class that extends WCMUsePojo class, you will get the error of “class file for aQute.bnd.annotation.ConsumerType not found“. This problem can be easily solved by adding the dependency to your parent-pom.xml and core-pom.xml as shown below: 123456789101112131415//parent-pom.xml <!– –> <dependency>     <groupId>biz.aQute.bnd</groupId>     <artifactId>bndlib</artifactId>     […]

Strategy to Consider when Migrating a Large Amount of Assets into an AEM author Instance

One of my biggest strategies to consider when migrating a large number of assets to production live AEM author instance is to enable/disable the workflow launchers. Every time when a new asset is installed (via the package manager) or uploaded into AEM, the OOTB (out of the box) AEM workflow launchers will be triggered. During […]

How to enable/disable AEM Workflow Launchers

Adobe Experience Manager (AEM) Assets ships with a number of default workflows and media handlers to operate on assets. Examples of these operations are generating thumbnail renditions, parsing Microsoft word documents, asset metadata extraction, etc… During appropriate understanding, we may need to disable workflow launchers services; always remember to re-enable after disabling these services. Quick […]

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 AEM Backend, an example of using global objects The global objects are accessible by OSGI’s dependency injection annotation; @inject. GET, […]

How to revert deployed packages in CRX/DE package manager?

In this tutorial, you will learn how to revert a deployed package in CRX/DE package manager. The package is uploaded into CRX/DE and not yet replicated. Visit CRX/DE Lite (http://localhost:4502/crx/packmgr/index.jsp) Locate the project package. Click on “more” (the drop-down on the right). Click on “uninstall” (this will ensure your AEM instance is back to what […]

Back To Top