Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

6.2 touch ui : datasource slingRequest

Avatar

Level 2

Hello,

i have a problem with the slingRequest in the datasource. slingRequest return a OnDemandReaderRequest instead of SlingHttpServletRequest at the creation of the page. how to please get the suffix with a OnDemandReaderRequest? i don't recovers /content/geometrixx/en.

 

Regards

5 Replies

At the creation of the page this code (slingRequest.getRequestPathInfo().getSuffix()) return the path of the template (/apps/global/templates/searchpage), and not the suffix /content/geomettrix/en

 

if(StringUtils.isNotEmpty(slingRequest.getRequestPathInfo().getSuffix())){ path = slingRequest.getRequestPathInfo().getSuffix(); }else{ path = slingRequest.getRequestParameter("item").getString() ; }

you can change extension in attachment to zip and import in your package. after, you can create a page in /content/geometrixx/en. put a log in datasource and check, the suffix does not return the good suffix..

It is a exemple simple, but it sums up my problem.

Avatar

Community Advisor

Hi Marion,

Thank you for prompt response and code sample,

When working with dynamic dropdown's have not used the jsp code as find it no as readable as Java code, you are requesting here request that should resolve to the 'geometrixx/components/datasource/datasourceLanguage'.

Why not register a Servlet that would receive your request and produce the results?

This way i would hope you would get whatever comes into Sling Request as a correct Suffix.(given request has correct suffix).

Regards,

Peter

No, I just do the test .Same with servlet. i have always a org.apache.sling.scripting.core.impl.helper.OnDemandReaderRequest which return a bad suffix :(