0
votes

I'm loading a resource in AEM using SlingRequestProcessor as the example available here.

My page/html file looks like:

<div data-sly-use.stepPlanItem="stepPlanItemTemplate.html"
    data-sly-call="${stepPlanItem.step @ step = step}"
    data-sly-unwrap />

But, when I invoke requestProcessor.processRequest(req, resp, request.getResourceResolver()); nothing happens. I'm getting exactly the same content of the file. Nothing is being parsed.

My main question is: How can I parse sly tags from Java code?

Should I use filters? Which one? This is a page (not an AEM one) just an HTL snippet.

1
Are you trying to render a file such as /content/myapp/myfile.html with this content and expecting HTL to be parsed and executed? You need to check how Sling Resource Resolution works first: helpx.adobe.com/ca/experience-manager/6-4/sites/developing/… - Vlad

1 Answers

1
votes

You do not need to parse HTL files, this is done by the Sling Scripting Engine implementation. You are always processing/loading a resource and it needs to be resolved according to the Sling resource resolution.

Assuming you are trying to load a resource at: /content/myapp/mypage.html that has a sling:resourceType=myapp/myfile, you would put the above code snippet in an /apps/myapp/myfile/myfile.html file so that the scripting engine can execute the HTL.