Expand my Community achievements bar.

SOLVED

Replacing Request parameters to selectors in URL.

Avatar

Level 10

Hi,

Can anyone tell me how to convert request parameters and values to selectors in URL.
Example query parameter URL: http://IP:4503/content/en/mobilecontent/services.catalogContent.json?gameIds=2020-2020,2121-2121.

Thanks,
Venkata.

 

 

1 Accepted Solution

Avatar

Correct answer by
Level 10

Here is a really detailed community article by one of our partners in AEM:

http://www.citytechinc.com/us/en/blog/2013/08/apache-sling-selectors-request-parameters.html

I have never seen passing parameters without using ? in a Sling URL. 

View solution in original post

5 Replies

Avatar

Level 10

Hi 

A selector and parameters both make up a request. See the Sling  cheat sheet:

 

http://docs.adobe.com/docs/en/cq/5-6-1/developing/sling_cheatsheet.html

Avatar

Level 10

Hi Scott,

We want to remove the question mark with request parameters for Apache caching.
So, Is there any way to send the parameters and values through URL without "?".

Thanks in Advance,
Ratna Kumar.

Avatar

Correct answer by
Level 10

Here is a really detailed community article by one of our partners in AEM:

http://www.citytechinc.com/us/en/blog/2013/08/apache-sling-selectors-request-parameters.html

I have never seen passing parameters without using ? in a Sling URL. 

Avatar

Community Advisor

Ratna Kumar wrote...

Hi Scott,

We want to remove the question mark with request parameters for Apache caching.
So, Is there any way to send the parameters and values through URL without "?".

Thanks in Advance,
Ratna Kumar.

 

If your only concern is to cache the page when it contains query params then you can configure this in dispatcher itself under /ignoreUrlParams , here you need to configure all valid params under /ignoreUrlParams for which page should be cached.

You can know more /ignoreUrlParams on https://docs.adobe.com/docs/en/dispatcher/disp-config.html

E.g. /ignoreUrlParams is configured under /cache, something like below:

/cache

{

          /ignoreUrlParams
            {
                /0001 { /glob "*" /type "deny" }
                /0003 { /glob "cq_ck" /type "allow" }
                /0004 { /glob "wcmmode" /type "allow" }
            }

}

Above will cache the page and return the cached page even when query param present is one of cq_ck or wcmmode.

Once you have done it, make sure you have your JS read the parameter for you and refresh the content accordingly on the page, if you don't do this then it will always display static data and your content won't refresh per ID present in attribute.

- Runal

Avatar

Level 10

Thanks Runal and Scott..We will work on this and let you know.

Thanks,
Ratna Kumar.