2016-11-03 10 views
0

私はAEM 5.6.1で実行する単純なSlingフィルタを作成しています。私はフィルタに設定プロパティを使用させました、そして、私はそれが/ system/console/configMgrに表示されることを期待していましたが、そうではありません。私はバンドルをインストールすることができるよApache FelixへのSlingFilterの追加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); 
    } 
} 

は、フィルタが動作していると/システム/コンソール/バンドルでそれを見つけることができることがわかり、それは私のように/システム/コンソール/ ConfigMgrのに追加されません。それが@Propertyアノテーションの存在から考えていました。私は一歩足りなかった?

答えて

1

構成マネージャーに表示する構成が必要な場合は、generateComponentと一緒にmetatype = trueを指定する必要があります。デフォルトでは、metatypeはfalseです。

@SlingFilter(generateComponent = true, 
    generateService = true, 
    metatype = true, 
    order = -700, 
    scope = SlingFilterScope.REQUEST) 

はそれをよりよく理解するためにApache Felix - SCR AnnotationsApache Felix Metatype Serviceを参照してください。

関連する問題