Chuyển đến nội dung chính

Bài đăng

Đang hiển thị bài đăng từ Tháng 11, 2015

[COMPONENT] CQ filter

Sling Request Invocation Chain     Implementing Sling Filters Registration of Filters Standard Servlet Filter (javax.servlet.Filter) Need to be registered as Service („manually“ or SlingFilter SCR Annotation) Order and FilterScopes can be defined Order defined by Serviceranking Filterscopes REQUEST COMPONENT ERROR INCLUDE * FORWARD * * FilterChain executes COMPONENT scope for these scopes as well. SCR Annotation @SlingFilter(scope = SlingFilterScope.COMPONENT, order = -10000, metatype = false) public class MyComponentFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest pRequest, ServletResponse pResponse, FilterChain pChain) throws IOException, ServletException { // Implement Filter // continue with filter chaining pChain.doFilter(pRequest, pResponse); } } Filter Order Existing Filters might use the deprecated “filter.order” instead “service.ranking”. ...

[COMPONENT] Set a CQ5 component to editable or not editable

Question: Is it posible if i want to set a cq5 component C editable in page A, but not editable in page B. Solution: You can set ComponentContext.BYPASS_COMPONENT_HANDLING_ON_INCLUDE_ATTRIBUTE before the include, and remove it after the include. slingRequest.setAttribute(ComponentContext. BYPASS_COMPONENT_HANDLING_ON_INCLUDE_ATTRIBUTE, true); <sling:include component C/> slingRequest.removeAttribute(ComponentContext. BYPASS_COMPONENT_HANDLING_ON_INCLUDE_ATTRIBUTE); Ref: https://dev.day.com/docs/en/cq/current/developing/boilerplates.html