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

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

Avatar

Level 2

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() ; }

Avatar

Level 2

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

Avatar

Level 2

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 😞