might be best explained with an example. Thanks for the assistance.
EDIT: Accordingt to this page https://sling.apache.org/apidocs/sling11/org/apache/sling/servlets/annotations/SlingServletFilter.ht...), pattern accepts regex value.
This one works.
(service = Filter.class, property = {
"sling.filter.scope=REQUEST",
"sling.filter.pattern=^/content/myapp/sg/en/login.*",
"service.ranking:Integer=100"
})
This one does not work.
(service = Filter.class, property = {
"sling.filter.scope=REQUEST",
"sling.filter.pattern=^/content/myapp/sg/en/(login|members).*",
"service.ranking:Integer=100"
})
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @jayv25585659,
Try this with one regex or by registering multiple patterns as separate filter instances. The sling.filter.pattern property itself is a single regex string, not a list.
@Component(service = Filter.class, property = {
"sling.filter.scope=REQUEST",
"sling.filter.pattern=^/content/myapp/sg/en/(?:login|members)(?:$|/|\\.|\\?).*",
"service.ranking:Integer=100"
})
Hi @jayv25585659 ,
The syntax for second pattern doesn't look good. Can you try to use something like below:
(service = Filter.class, property = {
"sling.filter.scope=REQUEST",
"sling.filter.pattern=((^/content/myapp/sg/en/login.*) |(/content/myapp/sg/en/members.*))",
"service.ranking:Integer=100"
})
Hope ite helps!
-Tarun
Views
Replies
Total Likes
Hi @jayv25585659,
Try this with one regex or by registering multiple patterns as separate filter instances. The sling.filter.pattern property itself is a single regex string, not a list.
@Component(service = Filter.class, property = {
"sling.filter.scope=REQUEST",
"sling.filter.pattern=^/content/myapp/sg/en/(?:login|members)(?:$|/|\\.|\\?).*",
"service.ranking:Integer=100"
})
thank you for mentioning "?:" I'm not familiar with it.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies