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…
Choose your answer, then check it against the explanation.
A developer is asked to create an Adobe Experience Manager servlet MyServlet that listens for HTTP
requests capable of handling the GET method. The servlet must be registered using Declarative
Services (OSGi) and be bound to a specific resource type /my/resourcetype allowing it to serve
requests for a particular component.
What is the correct way to register a servlet?
A)
@SlingServletResourceTypes(resourceTypes ="/my/resourcetype", methods = {"get"})
public class MyServlet extends SlingSafeMethodServlet {
@Override
protected void doGET(SlingHttpServletRequest request, SlingHttpServletResponse response)
throws ServletException, IOException {
// Handle get request
}
}
B)
@SlingServletResourceTypes(resourceTypes="/my/resourcetype", methods = { "GET" })
public class MyServlet extends SlingAllMethodsServlet {
@Override
protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
throws ServletException, IOException {
// Handle get request
}
}
C)
@SlingServletResourceTypes(resourceTypes ="/my/resourcetype", methods = { "get" })
public class MyServlet extends SlingSafeMethodServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
// Handle get request
}
}
Question 1 of 10
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…
