Highlighted

WKND SimpleServlet returns 404

Avatar

Avatar

paulm54716093

Avatar

paulm54716093

paulm54716093

12-05-2018

I'm having some issues upgrading 6.2 Servlets to 6.4. So I tried uploading the WKND packages to see if the SimpleServlet is working:

WKND Packages location = Getting Started with AEM Sites - WKND Tutorial

Looking at the class annotations from the github repo : https://github.com/Adobe-Marketing-Cloud/aem-guides-wknd/blob/39e1309542b2086ac5fc031c4f8ec337f7d0a5...

/**

* Servlet that writes some sample content into the response. It is mounted for

* all resources of a specific Sling resource type. The

* {@link SlingSafeMethodsServlet} shall be used for HTTP methods that are

* idempotent. For write operations use the {@link SlingAllMethodsServlet}.

*/

@Component(service=Servlet.class,

  property={

  Constants.SERVICE_DESCRIPTION + "=Simple Demo Servlet",

  "sling.servlet.methods=" + HttpConstants.METHOD_GET,

  "sling.servlet.resourceTypes="+ "wknd/components/structure/page",

  "sling.servlet.extensions=" + "txt"

  })

public class SimpleServlet extends SlingSafeMethodsServlet {

it seems like the url http://localhost:4502/content/wknd/en.txt

should return just the page title as text.

However, I'm getting a 404 - the servlet does not seem to be registered with Sling.

Any help is greatly appreciated!

Replies

Highlighted

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

12-05-2018

your servlet will be invoked only if node contains sling:resourceType= wknd/components/structure/page
you need to invoke servlet like below

url http://localhost:4502/content/wknd/en/jcr:content.txt

Thanks

Arun