How to add more patterns to @SlingServletFilter | Community
Skip to main content
Level 2
Nov 15, 2022 11:23 AM UTC
Solved

How to add more patterns to @SlingServletFilter

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/.*"

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Nov 15, 2022 12:16 PM UTC

Hi,

Its a regex, you ca add any regex pattern

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

2 replies

arunpatidar
arunpatidarAccepted solution
New Participant
Nov 15, 2022 12:16 PM UTC

Hi,

Its a regex, you ca add any regex pattern

pattern = "/content/(site|site2|site3)/.*",
Translate
Arun Patidar
Level 2
Nov 15, 2022 12:24 PM UTC

thank you so much @arunpatidar , just tried it

Translate