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

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

How to add more patterns to @SlingServletFilter

Avatar

Level 2

Hi all,

I have a requirement to add 3 specific sites instead of all the sites like /content/.* to my filter pattern, but since pattern accepts only a single string, i am stuck with how to do it. Any ideas on how to proceed with this? ( I am new to AEM)

@SlingServletFilter(
scope = {SlingServletFilterScope.REQUEST},
pattern = "/content/.*",
resourceTypes = "cq:Page",
extensions = {"html"},
methods = {"GET"}
)

i want to add pattern = "/content/site1/.*" , "/content/site2/.*" , "/content/site3/.*"

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

Its a regex, you ca add any regex pattern

pattern = "/content/(site|site2|site3)/.*",

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hi,

Its a regex, you ca add any regex pattern

pattern = "/content/(site|site2|site3)/.*",