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.
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.