Expand my Community achievements bar.

SOLVED

Reserved characters in Sling suffix

Avatar

Level 2

Greetings,

Recently was looking for approaches on how to pass cacheable (on Dispatcher / CDN tiers) parameters to Sling Servlets and the optimal solution seems to be usage of Sling suffixes.

There the following URI template comes up:

/bin/project/endpoint.json/parameter=value/parameter2=value2/.json

The approach seems to be good from the point of view of request readability; it is being properly parsed on the Sling level and cached on the Dispatcher tier.

However, I am a bit concerned about its compliance with the URI specification that says that '=' sing is a reserved symbol (RFC 3986 - Uniform Resource Identifier (URI): Generic Syntax), whereas there is no such such term as 'suffix' in the URI specification.

Is there a chance that someone could shed a light on the subject whether such suffix format is allowed or not?

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

The term "suffix" is just a naming used by sling, and from an HTTP perspective there is nothing special with these URLs. Also you can easily encode the "=" character in the url, it's being decoded transparently before the resolution.

And next to suffixes you can also use selectors.

Jörg

View solution in original post

1 Reply

Avatar

Correct answer by
Employee Advisor

The term "suffix" is just a naming used by sling, and from an HTTP perspective there is nothing special with these URLs. Also you can easily encode the "=" character in the url, it's being decoded transparently before the resolution.

And next to suffixes you can also use selectors.

Jörg

The following has evaluated to null or missing: ==> liql("SELECT id, subject, body, depth, post_time, author.login, author.id, author.rank, metrics.views FROM messages WHERE topic.id = '${topicId}' AND is_solution = true").data.items[0] [in template "analytics-container" at line 82, column 31] ---- Tip: It's the final [] step that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign acceptedAnswer = liql("SELECT... [in template "analytics-container" at line 82, column 5] ----