Hello,
Is it even possible to restrict sing filters based servlet paths or resource types? I tried those properties but no use. Every filter gets called for every request. sling.filter.pattern or sling.filter.pattern or sling.filter.resourceTypes does not seem to work. Am i doing something wrong?
THanks,
Solved! Go to Solution.
Views
Replies
Total Likes
You can restrict request scope by the below filter patterns.
@component(service = { Filter.class },immediate = true, property = {
"osgi.http.whiteboard.filter.pattern=/content/*",
"osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name=*)",
"osgi.http.whiteboard.context.path=/content",
"osgi.http.whiteboard.servlet.pattern=/content/*",
})
You can try out the above filter annotations.
Hi, maybe you can try with this. these are properties of a servlet restricted for a specific resource type, on get method, with xml extension and a selector.
I use these for define a sitemap servlet on the homepage. (same as you can do with acs commons).
@Component(service = { Servlet.class }, property = {
"sling.servlet.resourceTypes=" + "fs_news/components/structure/hp_page", "sling.servlet.methods=" + "GET",
"sling.servlet.extensions=" + "xml", "sling.servlet.metatype=" + "true",
"sling.servlet.selector=" + "sitemap",
})
And this is the get method override:
@Override
protected void doGet(SlingHttpServletRequest slingRequest, SlingHttpServletResponse slingResponse)
throws ServletException, IOException {
Views
Replies
Total Likes
You can restrict request scope by the below filter patterns.
@component(service = { Filter.class },immediate = true, property = {
"osgi.http.whiteboard.filter.pattern=/content/*",
"osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name=*)",
"osgi.http.whiteboard.context.path=/content",
"osgi.http.whiteboard.servlet.pattern=/content/*",
})
You can try out the above filter annotations.
Views
Replies
Total Likes
You can restrict request scope by the below filter patterns.
@component(service = { Filter.class },immediate = true, property = {
"osgi.http.whiteboard.filter.pattern=/content/*",
"osgi.http.whiteboard.context.select=(osgi.http.whiteboard.context.name=*)",
"osgi.http.whiteboard.context.path=/content",
"osgi.http.whiteboard.servlet.pattern=/content/*",
})
You can try out the above filter annotations.
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies