Posts

Showing posts from July, 2016

Developing Single Page Applications in AEM using AngularJS

Image
In this article I am going to walk you through how you can develop extensible AngularJS application (to be specific templates and component) in AEM. If you have fair understanding of AngularJS and AEM then it would be easy for you understand this tutorial else I’ll recommend to gain at least basic knowledge of both before you attempt to follow this article. I have spent initial few years of my career to write pure server side application using Java/J2EE (Servlet, JSP, Spring, different ORMs etc.) with little bit of JavaScript (jQuery etc.) and I was enjoying it. From last few years I have also started using modern JavaScript framework like AngularJS very heavily and it is a great experience and I am enjoying it even more and I’ll definitely recommend to learn and leverage it if you can. Let’s start with a quick overview of both AEM and AngularJS. AngularJS If you are in web development filed (specially front end) then I am sure you must have heard about AngularJS. I

AEM & Schema Based JSON Editor

Image
AEM is very powerful when it comes to delivering content via REST. REST is core of AEM and with Sling’s selectors, resource resolution etc. it becomes even more powerful. Also, now a days REST has become a standard for applications to exchange data in stateless manner. To exchange data most of the time we use JSON format. You might have created component, templates and pages etc. and also, you may have used .json selector (which outputs JSON in predefined format) to get JOSN representation of page but, have you every ran into a use case where you really want to manage real JSON data in AEM in similar way as you manage other pages? In this post I’ll walk you through how to manage JSON (static only) in AEM. So, lets define a use case and acceptance criteria. Use Case & Acceptance Criteria 1. We want to create a JSON editor (GUI based) component in AEM using which we can create/manage JOSN data in AEM. 2. We should be able to download JSON as a file. 3. We should

AEM, FORM Submission & Handling POST requests

In this article I’ll be specifically talking about how to handle POST request in AEM and what options we have. Please note that Adobe has added more security around handling POST request from AEM 6.x onwards to prevent CSRF attack. If you don’t configure AEM correctly, POST requests will not work even after using any of methods explained in this article.   You can read more about security configurations and restriction at: https://docs.adobe.com/docs/en/aem/6-1/develop/security/csrf-protection.html It is very common use cases to have external application POST some data to an AEM page (e.g. /content/en/home.html) or even submit a form (POST) to same URL. But, as you know that in AEM POST works differently and any POST call to AEM is intercepted by Sling’s POST servlet (org.apache.sling.servlets.post.impl.SlingPostServlet). In some cases org.apache.sling.servlets.post.impl. SlingPostServlet is very useful when you actually want to perform CURD (create, update, read and d