Monday, July 4, 2022

OSGI Annotations

  In last blog we discussed how to register a servlet in AEM. Below are the    OSGI       annotations used in servlet.

  • @Component annotation - This OSGi annotation signifies that the class is a Service component and is not processed at runtime by a Service Component Runtime (SCR) implementation. It must be processed by tools and used to add a Component Description to the bundle.

  • service property - This signifies the types under which to register this Component as a service. In our case, the component is registered under the Servlet type. 

  • Constants.SERVICE_DESCRIPTION - Defines standard names for the OSGi environment system properties, service properties, and Manifest header attribute keys. In our case, we are defining the description of our servlet.

  • sling.servlet.methods - Defines which methods this servlet will use. In our case, we are using the HTTP GET method.

  • sling.servlet.resourceTypes - This property defines how are we accessing the servlet. There are two ways - via resource types and via paths. We will discuss this in the next section.

  • sling.servlet.extensions - The request URL extensions supported by the servlet for requests. The property value must either be a single String, an array of Strings or a Vector of Strings. This property is only considered for the registration with sling.servlet.resourceTypes.
Happy learning!

 


No comments:

Post a Comment

Install yarn on windows

 In this article, we will see how we can install yarn on windows. First lets understand what yarn is? Yarn is an established open-source pac...