Sling Servlet

 Lets start with code and understand line by line.

@Component(service = { Servlet.class })

@SlingServletResourceTypes(

        resourceTypes="reactLearning/components/page",

        methods=HttpConstants.METHOD_GET,

        extensions="txt")

@ServiceDescription("Simple Demo Servlet")

public class SimpleServlet extends SlingSafeMethodsServlet {


@Component:

  • Identify the annotated class as a Service Component.
  • The annotated class is the implementation class of the Component.
  • This annotation is not processed at runtime by Service Component Runtime. 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.





































Comments

Popular posts from this blog

First AI project