【发布时间】:2017-03-17 15:45:57
【问题描述】:
我正在编写一个简单的 Sling 过滤器以在 AEM 5.6.1 上运行。我已经让过滤器使用配置属性,我希望它会出现在 /system/console/configMgr 中,但它没有。
@SlingFilter(generateComponent = true, generateService = true, order = -700, scope = SlingFilterScope.REQUEST)
public class SimpleFilter implements Filter {
@Property(value = "property.defaultvalue")
private static final String PROPERTY_KEY = "property.key";
private String configuredValue;
@Activate
protected void activate(final ComponentContext componentContext) throws Exception {
Map<String, String> config = (Map<String, String>) componentContext.getProperties();
this.configuredValue = config.get(PROPERTY_KEY);
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
System.out.println(this.configuredValue);
}
}
我能够安装捆绑包,看到过滤器正在工作并且可以在 /system/console/bundles 中找到它,但它并没有像我想象的那样被添加到 /system/console/configMgr @Property 注释的存在。我错过了一步吗?
【问题讨论】: