SlideShare a Scribd company logo
Touching the AEM component dialog
Mateusz Chromiński
Curiousity
Pre-AEM 6.0
Pre-AEM 6.0
/content/page/jcr:content/parsys/
component.infinity.json
{
"jcr:primaryType":"nt:unstructured",
"property1":"value1",
"nested":{
"jcr:primaryType":"nt:unstructured",
"property2":"value2",
{
"jcr:primaryType":"cq:Dialog",
"title":"My Component",
"xtype":"tabpanel",
"items":{
"jcr:primaryType":"cq:WidgetCollection",
/apps/myApp/myComponent/
dialog.infinity.json
Pre-AEM 6.0
"xtype":"cqinclude"
Pre-AEM 6.0
/apps/components/list/_cq_dialog.html
/content/page/jcr:content/
list
granite/ui/components/foundation/
form/select
TouchUI
GET /apps/components/list/_cq_dialog.html/content/page/jcr:content/list?resourceType=components%2Farticle
query parameter
suffix
extension
resource path
content link
dialog rendering
component resource type
request.getRequestPathInfo()
.getSuffixResource()
URL decomposition
Stores user data
Widget
AEM authoring
sling:resourceType
Content
Defines form field HTML
markup
Dialog
Lists all dialog field
types with content links
• @SlingServlet(resourceType=...
Sling servlets
• /bin/app/myServlet.json
Resource scripts
• /apps/myApp/component/component.jsp
Resource Resolution
<selection
jcr:primaryType=”nt:unstructured”
sling:resourcetype=”granite/ui/components/foundation/form/select”
fieldLabel=”Select one”>
<items jcr:primaryType=”nt:unstructured”>
<item_0
jcr:primaryType=”nt:unstructured”
text=”Option 1”
value=”value1”/>
<item_1
jcr:primaryType=”nt:unstructured”
text=”Option 2”
value=”value2”/>
Datasource - static
<selection
jcr:primaryType=”nt:unstructured”
sling:resourcetype=”granite/ui/components/foundation/form/select”
fieldLabel=”Select one”>
<datasource
jcr:primaryType=”nt:unstructured”
sling:resourceType=”cq/gui/components/projects/admin/datasource/gadgetdatasource”>
/libs/cq/gui/components/projects/admin/datasource/gadgetdatasource/gadgetdatasource.jsp
<%@include file=”/libs/foundation/global.jsp”%><%
...
request.setAttribute(DataSource.class.getName(), ds);
%>
Datasource – dynamic
@SlingServlet(resourceTypes = { ”touch/components/datasource” })
public class DataSourceServlet extends SlingSafeMethodsServlet {
@Override protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
throws ServletException, IOException {
List<Resource> resources = new ArrayList<>();
List<MyItemModel> items = getItems();
for (MyItemModel item : items) {
ValueMap valueMap = new ValueMapDecorator(new HashMap<>());
valueMap.put(”value”, item.getValue());
valueMap.put(”text”, item.getText());
resources.add(new ValueMapResource(request.getResourceResolver(), new ResourceMetadata(),
JcrConstants.NT_UNSTRUCTURED, valueMap);
}
DataSource dataSource = new SimpleDataSource(resources.iterator());
request.setAttribute(DataSource.class.getName(), dataSource);
}
}
Datasource on servlet
@SlingServlet(resourceTypes = { ”touch/components/widgetInclude” })
public class WidgetIncludeServlet extends SlingSafeMethodsServlet {
@Override protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
throws ServletException, IOException {
Resource finalResource = getFinalResource(request);
if(finalRequest == null) {
response.sendError(404);
} else {
RequestDispatcher dispatcher = request.getRequestDispatcher(finalResource);
dispatcher.include(request, response);
}
}
}
Include through servlet
Front-end
CoralUI
Styling
jQuery
Dynamic
Classic UI Touch UI
Data return format JSON HTML
Data rendering way infinity.json JSP / Sling rendering
HTTP dialog calls 2+ 1
Processing side Front-side Back-end
Styling ExtJS Coral
Dynamic ExtJS hooks jQuery
Comparison
Mateusz Chromiński
Senior Software Engineer @ Cognifide
mateusz.chrominski@cognifide.com
mateusz_chrominski
Thank you

More Related Content

Viewers also liked (20)

PDF
AEM 6.1 User Interface Customization
Christian Meyer
 
PPTX
Building Quality into the AEM Publication Workflow with Active Standards by D...
AEM HUB
 
PDF
AEM Best Practices for Component Development
Gabriel Walt
 
PPTX
Adobe Meetup AEM Architecture Sydney 2015
Michael Henderson
 
PPTX
AEM (CQ) Dispatcher Security and CDN+Browser Caching
Andrew Khoury
 
PDF
User Interface customization for AEM 6
Damien Antipa
 
PPTX
New Repository in AEM 6 by Michael Marth
AEM HUB
 
PPTX
When dispatcher caching is not enough by Jakub Wądołowski
AEM HUB
 
PPTX
Adobe Managed Services: Complicated Cloud Deployments by Adam Pazik, Mike Til...
AEM HUB
 
PDF
Sling Models Using Sightly and JSP by Deepak Khetawat
AEM HUB
 
PPTX
Four approaches to integrate aem with external systems by Jan Kuzniak
AEM HUB
 
PDF
Accelerate Your Next AEM Project
Mark Kelley
 
PDF
Sling Component Filters in CQ5
connectwebex
 
PPTX
Bombardier adobe aem msm implementation
Ken Knitter
 
PPTX
Dynamic components using SPA concepts in AEM
Bojana Popovska
 
PPTX
Aem best practices
Jitendra Tomar
 
PDF
Introduction to Marketing Cloud UI, Adobe Summit 2014
Damien Antipa
 
PDF
Build single page applications using AngularJS on AEM
connectwebex
 
PDF
AEM Sightly Deep Dive
Gabriel Walt
 
PDF
Adobe AEM - From Eventing to Job Processing
Carsten Ziegeler
 
AEM 6.1 User Interface Customization
Christian Meyer
 
Building Quality into the AEM Publication Workflow with Active Standards by D...
AEM HUB
 
AEM Best Practices for Component Development
Gabriel Walt
 
Adobe Meetup AEM Architecture Sydney 2015
Michael Henderson
 
AEM (CQ) Dispatcher Security and CDN+Browser Caching
Andrew Khoury
 
User Interface customization for AEM 6
Damien Antipa
 
New Repository in AEM 6 by Michael Marth
AEM HUB
 
When dispatcher caching is not enough by Jakub Wądołowski
AEM HUB
 
Adobe Managed Services: Complicated Cloud Deployments by Adam Pazik, Mike Til...
AEM HUB
 
Sling Models Using Sightly and JSP by Deepak Khetawat
AEM HUB
 
Four approaches to integrate aem with external systems by Jan Kuzniak
AEM HUB
 
Accelerate Your Next AEM Project
Mark Kelley
 
Sling Component Filters in CQ5
connectwebex
 
Bombardier adobe aem msm implementation
Ken Knitter
 
Dynamic components using SPA concepts in AEM
Bojana Popovska
 
Aem best practices
Jitendra Tomar
 
Introduction to Marketing Cloud UI, Adobe Summit 2014
Damien Antipa
 
Build single page applications using AngularJS on AEM
connectwebex
 
AEM Sightly Deep Dive
Gabriel Walt
 
Adobe AEM - From Eventing to Job Processing
Carsten Ziegeler
 

More from AEM HUB (20)

PDF
Microservices for AEM by Maciej Majchrzak
AEM HUB
 
PPTX
PhoneGap Enterprise Viewer by Anthony Rumsey
AEM HUB
 
PDF
Integrating Apache Wookie with AEM by Rima Mittal and Ankit Gubrani
AEM HUB
 
PPTX
Mastering the Sling Rewriter by Justin Edelson
AEM HUB
 
PPTX
How to build a Social Intranet with Adobe Sites and 3rd Party products ... us...
AEM HUB
 
PPTX
How do you build flexible platforms that focuses on business needs? by Fahim...
AEM HUB
 
PDF
AEM Apps Enhanced: In-app Messaging and Beacons by John Fait
AEM HUB
 
PPTX
Effectively Scale and Operate AEM with MongoDB by Norberto Leite
AEM HUB
 
PPTX
Adobe Marketing Cloud Integrations: Myth or Reality? by Holger Marsen
AEM HUB
 
PDF
Responsive Websites and Grid-Based Layouts by Gabriel Walt
AEM HUB
 
PPTX
When Sightly Meets Slice by Tomasz Niedźwiedź
AEM HUB
 
PPTX
Creativity without comprise by Cleve Gibbon
AEM HUB
 
PDF
REST in AEM by Roy Fielding
AEM HUB
 
PPTX
Adobe Summit 2015 - Penguin Random House - Accelerating Digital Transformation
AEM HUB
 
PDF
Socialize your Exceptional Web Experience – Adobe AEM & IBM Connections by He...
AEM HUB
 
PDF
Sightly Beautiful Markup by Senol Tas
AEM HUB
 
PDF
Adobe Experience Manager - 6th Edition by Cedric Huesler
AEM HUB
 
PDF
Organizing the world of CQ rest infinitive possibilities by Arkadiusz Kita
AEM HUB
 
PDF
Rapid CQ deployments by Jakub Wadolowski
AEM HUB
 
PPTX
AEM 5.6.1 e-Commerce Integration by Meryll Blanchet
AEM HUB
 
Microservices for AEM by Maciej Majchrzak
AEM HUB
 
PhoneGap Enterprise Viewer by Anthony Rumsey
AEM HUB
 
Integrating Apache Wookie with AEM by Rima Mittal and Ankit Gubrani
AEM HUB
 
Mastering the Sling Rewriter by Justin Edelson
AEM HUB
 
How to build a Social Intranet with Adobe Sites and 3rd Party products ... us...
AEM HUB
 
How do you build flexible platforms that focuses on business needs? by Fahim...
AEM HUB
 
AEM Apps Enhanced: In-app Messaging and Beacons by John Fait
AEM HUB
 
Effectively Scale and Operate AEM with MongoDB by Norberto Leite
AEM HUB
 
Adobe Marketing Cloud Integrations: Myth or Reality? by Holger Marsen
AEM HUB
 
Responsive Websites and Grid-Based Layouts by Gabriel Walt
AEM HUB
 
When Sightly Meets Slice by Tomasz Niedźwiedź
AEM HUB
 
Creativity without comprise by Cleve Gibbon
AEM HUB
 
REST in AEM by Roy Fielding
AEM HUB
 
Adobe Summit 2015 - Penguin Random House - Accelerating Digital Transformation
AEM HUB
 
Socialize your Exceptional Web Experience – Adobe AEM & IBM Connections by He...
AEM HUB
 
Sightly Beautiful Markup by Senol Tas
AEM HUB
 
Adobe Experience Manager - 6th Edition by Cedric Huesler
AEM HUB
 
Organizing the world of CQ rest infinitive possibilities by Arkadiusz Kita
AEM HUB
 
Rapid CQ deployments by Jakub Wadolowski
AEM HUB
 
AEM 5.6.1 e-Commerce Integration by Meryll Blanchet
AEM HUB
 
Ad

Recently uploaded (20)

PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Why Orbit Edge Tech is a Top Next JS Development Company in 2025
mahendraalaska08
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
Ad

Touching the AEM component dialog by Mateusz Chromiński

Editor's Notes

  • #3: This presentation is all about the curiousity. Let me recall a story from my childhood. When I was a kid I used to touch everything. I wanted to learn all the things around and understand how they are working. All went more or less fine until I got a camera into my hands. I am old enough to remember analog cameras and it was one of that kind. After reviewing the object I found out, that there is a small cliche inside. Checking it against the light it occured that I can see all the photos from my vacation! That was the last time I’ve seen them As a child is always eager to deassemble items and check what’s inside, we engineers are always curious how things are actually working – how to assemble the item back again. The slides I will run through in couple of minutes are a result of my curiousity – I just refused to accept a simple statement – it works this way but wanted to understand it deeper. Today, I gonna share this experience with you.
  • #4: We all know how AEM authoring looks like. Let’s review how old, Classic UI approach looked like. Author asks AEM, AEM responds with simpe dialog – that’s it. Isn’t it? In fact – it is not! Lets take a look under the hood and figure out what’s going on.
  • #6: Actually, whenever author requests a dialog, an HTTP call is being sent to the AEM, to the JCR repository. The author’s browser needs to get a dialog definition that is stored inside the apps directory. The repository answers with simple data in JSON format. The response gets back to AEM and even further – to user browser. And it’s not done yet – the dialog can be rendered, all widgets are inside but we still lack the data to be presented to user. To get it, we require an additional HTTP request that is hitting AEM once again – this time for the content part. The response gets back to author and he is ready to use the dialog.
  • #7: Is he? What experience shows is that the systems we build are quite complex. Just as the dialogs are usually. Therefore, as good programmers we hate code duplication and we love to unify as much as possible. But the impact on the authoring, on dialog is that we use external links a lot. All of them produce additional HTTP requests that produce load on AEM instance on one hand and slows down authoring at the another.
  • #8: Knowing that, let’s consider how Granite flow looks like. From the user point of view, not much changes – author double clicks the component and he sees a modern-style dialog. What happens inside? Inside there is actually one HTTP call for the dialog. The call is extremely similar to the publish-like component requests. Within the dialog rendering we are iterating over all the containers and components – widgets and rendering them all. Each time we render a widget, we pass an additional link to the content, so the user data is already there, once the HTML markup for component is rendered. All together, user makes one call and gets fully usable HTML form markup that he can use.
  • #9: So how is this possible that the widget rendering is provided with an additional – content – data? Let’s have a look into the URL we can easily scrap from the browser. This URL is a shortened version of the List component dialog call. Dividing the link into smaller pieces, according to the Sling URL decomposition way, we can see, that there the call is mainly for the dialog rendering. We ask the dialog HTML rendering and that’s what we receive at the very end. What’s important is the suffix parameter that specifies the content path so it’s here where the user data is hidden. Nothing limits us from using additional query parameters that in this case is just simple full component resource type. Hey, did you know, the suffix – altough is just a simple path in the URL is almost designed for carrying such data? There is a dedicated method that helps you reading the suffix resource if the suffix is describing repository path? And have you ever considered passing some additional data for your component rendering? I used to set some request scope variable but not anymore! Suffix altogether with other parts of request URL can be used for such purpose.
  • #10: There are three actors here: Dialog widget definition node (dialog.xml) Dialog widget rendering node (form/textfield.jsp) Content node The request hits dialog resource first. The dialog content resource is then rendered by the specific Sling resource type. All of it is being invoked in the scope of given component instance – so some content node within the page. The dialog rendering takes all the content data – which is stored in the dialog node and iterates over all the items inside. For each of them, it renders the node using the specified resource type – specific to each form field type. Each of the operation takes benefit of the content node that is passed through the suffix every time.
  • #11: We are used to write resource scripts for all the component renderings – that’s natural. Most of the TouchUI widgets are written in the exact same way. Sling servlets are very natural for us whenever no HTML is rendered but rather JSON/XML format is required. Also, it’s more like an API approach – whenever we’d like to process the data on the client-side on in the another system, we usually stick to this approach. It’s important to notice, that actually you can easily attach sling servlets on the resource types. This approach gives you full user permission-check while access the resource. Also – it can simply replace resource script files – but who’d like to write HTML in servlets? So 90s...
  • #12: Servlets suit to TouchUI widgets quite well though! The application we’ve been migrating to the Touch interface include number of renderers that were nicely structured and unified. A lot of jsp files were inherited and reused across the components just as the dialog parts were shared. We used cqinclude xtype for that purpose. What we’ve realized while updating the dialogs is that it is very hard to forward the resource inclusion – to get it from the other resource. For that purpose we’ve created a new TouchUI widget that is capable of doing so.
  • #13: Servlets suit to TouchUI widgets quite well though! The application we’ve been migrating to the Touch interface include number of renderers that were nicely structured and unified. A lot of jsp files were inherited and reused across the components just as the dialog parts were shared. We used cqinclude xtype for that purpose. What we’ve realized while updating the dialogs is that it is very hard to forward the resource inclusion – to get it from the other resource. For that purpose we’ve created a new TouchUI widget that is capable of doing so.
  • #14: Servlets suit to TouchUI widgets quite well though! The application we’ve been migrating to the Touch interface include number of renderers that were nicely structured and unified. A lot of jsp files were inherited and reused across the components just as the dialog parts were shared. We used cqinclude xtype for that purpose. What we’ve realized while updating the dialogs is that it is very hard to forward the resource inclusion – to get it from the other resource. For that purpose we’ve created a new TouchUI widget that is capable of doing so.
  • #15: Servlets suit to TouchUI widgets quite well though! The application we’ve been migrating to the Touch interface include number of renderers that were nicely structured and unified. A lot of jsp files were inherited and reused across the components just as the dialog parts were shared. We used cqinclude xtype for that purpose. What we’ve realized while updating the dialogs is that it is very hard to forward the resource inclusion – to get it from the other resource. For that purpose we’ve created a new TouchUI widget that is capable of doing so.
  • #16: So we know how it happens the markup is rendered for you in TouchUI dialogs. But what makes them beautiful and shiny? It’s just a CoralUI library/stylesheets that is attached to all Granite interfaces and is responsible for styling the modern markup. You might ask yourself – how could I add some dynamic behaviour for my dialogs. Previously, this was heavy Javascript coding and it required ExtJS knowledge. Simple actions could have been achieved easily but just recall the cases where you were stuck while developing more complex requirements. ExtJS is gone Long live the king! TouchUI is browser friendly – the markup is far more clear than the extjs – autogenerated containers with hard to read ids and names. Now we can simply read this HTML. If any custom behaviour needs to be achieved – simply use well-known jQuery. Use data attributes for communication between widgets and for assigning custom behaviour. Did you know you can simply put a property in the dialog widget definition and it will be rendered into the markup as data attribute?