2016-11-03 5 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); 
    } 
} 

는 필터가 작동하고/시스템/콘솔/번들에서 찾을 수 있습니다 것을 볼 수 있지만 I처럼/시스템/콘솔/ConfigMgr에 추가되지 않습니다 @Property 주석의 유언장에서 생각했습니다. 나는 한 걸음도 놓쳤는가?

답변

1

구성 관리자에 구성을 표시하려면 generateComponent과 함께 metatype = true을 지정해야합니다. 기본적으로 메타 유형은 false입니다.

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

더 나은 이해 Apache Felix - SCR AnnotationsApache Felix Metatype Service를 참조하십시오.