Expand my Community achievements bar.

SOLVED

SLING REQUEST URL

Avatar

Level 4

what is the use of a suffix in a sling request URL? 

 

https://example.com/myhomepage.hp.html/a/b?id=1

 

In the URL above what is the use of /a/b ? 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Prashanth_02a,

Suffix usually used to provide additional information to your servlet/JSP page. Just check editor interface in TouchUI: the url looks like

http://localhost:4502/editor.html/content/pageYouEdit.html

So you always stays on the same page /editor.html, but suffix notifies Edit Interface which page to edit. 

Reference: Here is the best example between selector and suffix has been answered - https://stackoverflow.com/questions/41345775/what-is-the-use-of-suffix-in-sling-urls

 

Best way to use suffix in AEM URLs

It is better to use the suffix with selectors only that will help the dispatcher when flush cache.
Eg:-
<resource path>/results.html

<resource path>/results.html/suffix (Not recommended )

<resource path>/results.html/suffix.suffix1 (Not recommended )

<resource path>/results.slelector.html/suffix (Recommended)

<resource path>/results.slelector.html/suffix.suffix1 (Recommended)
 
Hope that helps!
Regards,
Santosh

View solution in original post

2 Replies

Avatar

Community Advisor

It depends on use case,

for example page editor use this to identify the page to be edited

http://localhost:1450/editor.html/content/myapp/us.html

 

 



Arun Patidar

Avatar

Correct answer by
Community Advisor

Hi @Prashanth_02a,

Suffix usually used to provide additional information to your servlet/JSP page. Just check editor interface in TouchUI: the url looks like

http://localhost:4502/editor.html/content/pageYouEdit.html

So you always stays on the same page /editor.html, but suffix notifies Edit Interface which page to edit. 

Reference: Here is the best example between selector and suffix has been answered - https://stackoverflow.com/questions/41345775/what-is-the-use-of-suffix-in-sling-urls

 

Best way to use suffix in AEM URLs

It is better to use the suffix with selectors only that will help the dispatcher when flush cache.
Eg:-
<resource path>/results.html

<resource path>/results.html/suffix (Not recommended )

<resource path>/results.html/suffix.suffix1 (Not recommended )

<resource path>/results.slelector.html/suffix (Recommended)

<resource path>/results.slelector.html/suffix.suffix1 (Recommended)
 
Hope that helps!
Regards,
Santosh