AD0-E137 practice question 1 of 10
A developer is asked to create an Adobe Experience Manager servlet MyServlet that listens for HTTP requests capable of handling the GET method. The…
Full set: 50 questionsThis option provides a functionally correct implementation for the requested servlet. The @SlingServletResourceTypes annotation correctly registers the servlet, binding it to the specified resource type (/my/resourcetype) and HTTP method (GET). While SlingSafeMethodsServlet is often considered a best practice for read-only operations, extending SlingAllMethodsServlet is a perfectly valid and functional approach. Most importantly, this option correctly overrides the doGet method with the proper case and the required (SlingHttpServletRequest, SlingHttpServletResponse) signature, making it the only fully working solution among the choices.
A: This option is incorrect because the method name is doGET. Java method names are case-sensitive, and the correct method to override from the SlingSafeMethodsServlet class is doGet. C: This option is incorrect because the doGet method signature uses the standard HttpServletRequest and HttpServletResponse types. To correctly override the method from the Sling base servlet, it must use SlingHttpServletRequest and SlingHttpServletResponse.
1. Apache Sling Documentation, "Servlets and Scripts": This official documentation outlines the registration of servlets using OSGi Declarative Services annotations like @SlingServletResourceTypes. It also clarifies the base servlet classes available.
Reference: Apache Sling Project, "Servlets and Scripts", Section: "Registering a Servlet". Available at: https://sling.apache.org/documentation/bundles/servlets.html
2. Apache Sling API Documentation (Javadoc) for SlingSafeMethodsServlet: The official Javadoc specifies the exact method signature to be implemented for handling GET requests.
Reference: org.apache.sling.api.servlets.SlingSafeMethodsServlet, Method Detail: protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response). Available at: https://sling.apache.org/apidocs/sling11/org/apache/sling/api/servlets/SlingSafeMethodsServlet.html
3. Adobe Experience League, "Servlets in AEM": This official Adobe guide provides examples and best practices for creating servlets in AEM, reinforcing the use of Sling's base classes and correct method overriding.
Reference: Adobe Experience League, "Servlets", Section: "Creating a simple servlet". The examples consistently show public class MySafeMethodServlet extends SlingSafeMethodsServlet { ... protected void doGet(...) ... }. Available at: https://experienceleague.adobe.com/docs/experience-manager-65/developing/introduction/servlets.html?lang=en
Keep practicing
Take the free AD0-E137 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other AD0-E137 practice questions
- Question 2A customer added a custom property "foo:bar" to all assets. Once the property is added, t…
- Question 3A developer is adding a reference script to a third-party analytics tool. The script need…
- Question 5An Adobe Experience Manager team is using an additional DEV environment in Adobe Experien…
- Question 6From which source environment can content be copied to Stage using Content sets in Cloud …
- Question 7A developer is tasked with designing a solution to accommodate multiple client projects w…
- Question 9A customer has the requirement to use SAML authentication on AEM using their SAML 2.0 com…
