Send Out Emails with AEM Servlet
In this article, we will be setting up the local AEM author developer’s environment to send out an email utilizing the Day CQ Mail Service. This article includes code snippets to a Sling Servlet that will be used to send out the email. We will be using a Google Gmail account as the SMTP Mail […]
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 […]
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 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/MyserviceImpl.java 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 […]