Enabling Sling Dynamic Include (SDI) with Edge Side Includes (ESI) result to a null request.getParameter value from model | Community
Skip to main content
New Participant
December 19, 2022
Solved

Enabling Sling Dynamic Include (SDI) with Edge Side Includes (ESI) result to a null request.getParameter value from model

  • December 19, 2022
  • 1 reply
  • 1343 views

Whenever I enable SDI in our configMgr, getting the values from request.getParameter() from the model result to a blank value.

 

The URL will be like https://www.test.com/app/replacement?searchstring=test

And the component called that is included in another .html page on the same directory:

<section data-sly-test="${'large' == properties.sizeVersion}" class=""> <div class=""> <sly data-sly-include="result.html"></sly> </div> </section>

Then result.html

<sly data-sly-use.repl="com.xxx.xxx.use.ReplacementResult"></sly> <sly data-sly-test="${repl.dataExist}"> <header class="b-deck__header"> <h3 class="">Header</h3> </header> </sly>

The result.html is being called, as well as the ReplacementResult model by debugging it. No errors. The searchstring becomes null/blank

searchstring = request.getParameter("searchstring");

I even tried removing the result.html, and just pasted it in the parent.html, still not able to get any param values from searchstring

 

Here is my config

 

Are there any config changes needed here?

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by pvancajas

Hi @arunpatidar ,

I checked the logs and I see the URL

Talking to a colleague, it seems that getParameter seems to be not working when SDI is enabled.

Anyways, thanks. It seems like this is a limitation of SDI that is either needed to be fixed, or we just have to make our components work with SDI limitation

Thank you


So, me and my colleagues have looked at this. And it seems like the approach I presented will not work at this point.

So, we may need to do / think of another way such as doing a servlet approach, but it can do a lot of changes in our code. So now, we may need to disable SDI as of the moment.

Thank you and I will close this one for now, maybe in the future this will be fixed.

1 reply

arunpatidar
New Participant
December 19, 2022

You can check the sample implementation here

https://github.com/arunpatidar02/aemaacs-aemlab/pull/21 

Arun Patidar
pvancajasAuthor
New Participant
December 19, 2022

Hi @arunpatidar , thank you for your reply! 🙂

Though, would you be so kind and direct me what part in your link I should check to be able to discover any fix for my problem? 

Thank you!

arunpatidar
New Participant
December 19, 2022

can you check the request logs, what you are getting as a request when you enable SDI?

When you enable the SDI, you get the additional request for that component, which will not be adding any parameters and thats why you will be getting null. This is expected.

You can see it from request.log.

Arun Patidar