AEM 서블릿을 만들었습니다. 이제 서비스로 정의되기 때문에 servlet 자체와 함께 OSGi 구성 (MULTI_FIELD 유형 배열 아래에 표시됨)을 작성했습니다. 자, 내 요구 사항 doGet 방법 안에이 osgi 구성에 액세스하는 방법입니다. 여기에 서블릿의 코드가있다.AEM 6.2 서블릿 자체와 함께 정의 된 OSGI 구성에 액세스하는 방법
@Component(label = "Sample Servlet", description = "Sample Servlet", immediate = true, metatype = true)
@Service
@Properties(value = {
@Property(name = "sling.servlet.resourceTypes", value = {
GlobalConstants.RES_TYPE,
GlobalConstants.PAGE_RES_TYPE }, propertyPrivate =
true),
@Property(name = "sling.servlet.selectors", value = {
GlobalConstants.PAGES,
GlobalConstants.ASSETS }, propertyPrivate = true),
@Property(name = "sling.servlet.extensions", value = "xml",
propertyPrivate = true),
@Property(name = "sling.servlet.methods", value = { "GET" }) })
public class SampleServlet extends SlingAllMethodsServlet {
@Property(value={"English", "Hindi"}, unbounded =
PropertyUnbounded.ARRAY, label = "Subjects", cardinality = 50,
description = "Example for Multi field config")
private static final String MULTI_FIELD = "multifield";
@Override
protected void doGet(final SlingHttpServletRequest request, final
SlingHttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
}
이 완벽하게 작동합니다 같은
방법은 보일 것이다. – user2581831