作为OSGI组件部署的CQ5.5订购标准HTTP过滤器 [英] CQ5.5 order standard HTTP filters deployed as OSGI components
问题描述
在CQ5.5中,我如何订购2个作为OSGI组件部署的标准HTTP过滤器?
In CQ5.5 How I can order 2 standard HTTP Filters deployed as OSGI components?
问题在于,这2个过滤器必须在FilterA应该运行的地方运行首先运行,然后依次运行FilterB。
The issue is that the 2 filters have to run in order where FilterA should run first and then FilterB in sequence.
如何依次订购2个过滤器?
How I can order my 2 filters in sequence?
知道我是否可以使用OSGI或SCR属性订购2过滤器,以便一个过滤器一个接一个地运行?
Do you know if there is any OSGI or SCR property with which I can order the 2 filter so that one should run after another?
例如:
过滤器A
@Component
@Service
@org.apache.felix.scr.annotations.Properties({
@Property(name = "pattern", value = "/.*"),
@Property(name = Constants.SERVICE_RANKING, intValue = 99999, propertyPrivate = false)
})
public class FilterA implements implements javax.servlet.Filter {
}
FilterB
@Component
@Service
@org.apache.felix.scr.annotations.Properties({
@Property(name = "pattern", value = "/.*"),
@Property(name = Constants.SERVICE_RANKING, intValue = 100000, propertyPrivate = false)
})
public class FilterB implements implements javax.servlet.Filter {
}
我想先运行FilterA,然后再运行FilterB。
I would like to run FilterA first and then FilterB.
如果我将上述过滤器部署为OSGI捆绑软件在CQ5.5上,我只能看到HTTP白板控制台上触发了FilterB。我什至看不到在我的CQ5.5登录请求流程中调用FilterA。
If I deploy the above filters as OSGI bundles on CQ5.5 I only see FilterB is triggered on the HTTP White board console. I do not see FilterA being even invoked during my CQ5.5 login request flow.
谢谢。
推荐答案
检查 http://sling.apache.org/site/filters .html
服务排名就是您想要的。还要注意sling / cq5,您可以通过查看/ system / console / config和Sling Servlet过滤器来查看哪些过滤器处于活动状态及其排名。
Check http://sling.apache.org/site/filters.html Service Ranking is what you're looking for. Also note on sling/cq5 you can see which filters are active and their ranking by looking /system/console/config and Sling Servlet Filters.
另请参见filter-scope和为引入基于模式的作用域而进行的更改( SLING-1213 , SLING-1734 )
Also see filter-scope and the changes made to introduce pattern based scopes (SLING-1213, SLING-1734)
这篇关于作为OSGI组件部署的CQ5.5订购标准HTTP过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!