Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

WKND SimpleServlet returns 404

Avatar

Level 2

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!

0 Replies

Avatar

Community Advisor

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