Tuesday, June 12, 2012

CQ5 : Creating new page and adding content

In this article, I am going to explain how to create new page and content using SlingHttpRequest Object <%@page import="com.day.cq.dam.api.Rendition"%> <%@page import="com.day.cq.dam.api.Asset"%> <%@page import="org.apache.sling.api.SlingHttpServletRequest"%> <%@include file="/libs/foundation/global.jsp"%> <%@page import="org.apache.sling.api.resource.ResourceResolver"%> <%@page import="com.day.cq.wcm.api.Template"%> <% ResourceResolver resolverPage = slingRequest.getResourceResolver(); Resource resPage...

Monday, June 11, 2012

CQ5 : Reading DAM assets

<%@page import="com.day.cq.dam.api.Rendition"%> <%@page import="com.day.cq.dam.api.Asset"%> <%@page import="org.apache.sling.api.SlingHttpServletRequest"%> <%@include file="/libs/foundation/global.jsp"%> <%@page import="org.apache.sling.api.resource.ResourceResolver"%> <% ResourceResolver resolver = slingRequest.getResourceResolver(); Resource res = resolver.getResource("/content/dam/geometrixx/movies"); Node rootNode = res.adaptTo(Node.class); if(rootNode!=null) { NodeIterator...

CQ5 Reading Node Properties

In CQ5 everything stores in the form of content ( Nodes and Properties ), but while reading content from repository the apache sling framework assumes this is a Resource.Because the sling follows REST based architecture In this article I am going to explore how to read properties of a Node <%@page import="org.apache.sling.api.SlingHttpServletRequest"%> <%@include file="/libs/foundation/global.jsp"%> <%@page import="org.apache.sling.api.resource.ResourceResolver"%> <% By using CRXDE I am going to create component called...