SlideShare a Scribd company logo
1 of 30
Download to read offline
Alfresco Surf Code Camp
Dispatcher and Site Construction
Objectives

                By the end of this module you should know
                     • How pages are dispatched
                     • How pages are assembled by invoking component renderers
                     • How Page Types & Themes work together




12/12/08   Optaros and Client confidential. All rights reserved.                 2
Site Dispatcher

             You've used web script-based components as Share
             Dashlets

             Now let's learn about how Surf sites and Surf pages
             are built




12/12/08                                                           3
Site Dispatcher

             The site dispatcher is responsible for figuring out
             which page should be assembled for a given request,
             and then assembling the page by invoking renderers
                   Page

                    Renderer




                    Renderer    Renderer




                    Renderer



12/12/08                                                           4
Model Objects

             Model Objects contain information about site
             construction

             A web site looks to these objects during render

             They define pages and page layout

             They define where components appear on pages




12/12/08                                                       5
Model Objects

             Model Objects are XML files

             Here is an example of a component XML file

             <?xml version='1.0' encoding='UTF-8'?>
             <component>
                <scope>global</scope>
                <region-id>footer</region-id>
                <source-id>global</source-id>
                <url>/age/footer</url>
                <properties>
                   <custom1>My custom property value</custom1>
                </properties>
             </component>




12/12/08                                                         6
List of Model Objects

           Types                   Associations
               Component Type             Page
                                   •
                                          Association
               Template Type
                                          Content
                                   •
               Page Type                  Association


           Instances               Site
                 Component                Configuration
           •                       •
                 Template                 Theme
           •                       •
                 Instance
                                          Chrome
                                   •
                 Page
           •




12/12/08                                                  7
Key Surf Page Construction Concepts

                                                                      SomeTemplate.ftl

  Pages                  Home                                          Header


               Blog                About
                                                                       Gutter            Body




            Template
           Instances &                                                           Regions
            Renderers

                                                                       Footer




                                                                              Component
                                                                             (Web Script)
12/12/08      Optaros and Client confidential. All rights reserved.                             8
Model Objects Graph




                  Page                                             Page
                                              Page
                  Type                                          Association




                 Template                   Template             Content
                   Type                     Instance            Association




                Component
                                            Component            Chrome
                  Type




                            Configuration               Theme




12/12/08                                                                      9
Dispatching

                      Regardless of the path, it always comes down to a
                      Page
                       • An Object is requested -> What page should display it?
                       • A Page Type is requested -> Which page is appropriate for this
                         Theme?
                       • A specific Page is requested


                           URI                             Resolves to a page
                          Servlet
                                               Page Type
           Requests

                                                                                To Rendering
                         Dispatcher
                                                                       Page
                          Servlet


                                                Object
                                                           Resolves to a page




12/12/08                                                                                       10
Page Dispatching Logic

           1. Example: Hitting the home page
                  http://labs3c:8580/alfwf/page?p=home
              




           2. Look up Page (in /site-data/pages)‫‏‬
                  Page has a template instance.
              




           3. Look up Template Instance (in /site-data/template-
             instances)‫‏‬
           4. Look up Renderer for Template
                  In this case the Renderer is a FreeMarker Template
              



                  Process regions on page by id
              




           5. Find Component Bindings for those region ids
           6. Look up Components (in /site-data/components)‫‏‬




12/12/08                                                               11
Page Dispatching Logic

             Look up the page object by page id: home
              • /WEB-INF/classes/alfresco/site-data/pages

                <?xml version='1.0' encoding='UTF-8'?>
                <page>
                   <title>Home Page</title>
                   <template-instance>home</template-instance>
                   <authentication>none</authentication>
                </page>



             Look up the template by template id: home
              • /WEB-INF/classes/alfresco/site-data/template-instances
               <?xml version='1.0' encoding='UTF-8'?>
               <template-instance>
                  <template-type>freemarker</template-type>
                  <url>/sample/home</url>
               </template-instance>

              OR
                                                                   Potentially
               <?xml version='1.0' encoding='UTF-8'?>
                                                                   confusing
               <template-instance>
                                                                 shortcut here!
                  <template-type>/sample/home</template-type>
               </template-instance>
12/12/08                                                                          12
Page Dispatching Logic

             Execute the Template Renderer for path:
             /sample/home
              • FreeMarker renderer
              • /WEB-INF/classes/alfresco/templates/sample/home.ftl
               <html>
                  <body>
                      <@region id=“SomeImage” scope=“page” />
                  </body>
               </html>


             Execute the region tag and find matching components
              • /WEB-INF/classes/alfresco/site-data/components
              • Search for components in page scope, bound to home page for
                the region ‘SomeImage’
                                                Components have a naming
              • page.test.home.xml
                                                convention which is duplicative of
                                                the XML it contains. Currently, the
                                                XML page, scope, and region XML
                                                are ignored, but in the future, the
                                                naming convention will be
                                                dropped.
12/12/08                                                                              13
Page Dispatching Logic

             Analyze the Component and prepare to render it
              • /WEB-INF/classes/alfresco/site-data/components

               <?xml version='1.0' encoding='UTF-8'?>
               <component>
                  <scope>page</scope>
                  <region-id>SomeImage</region-id>
                  <source-id>home</source-id>
                  <url>/blocks/image</url>
                  <properties>
                     <src>${url.context}/images/masay.jpg</src>
                  </properties>
               </component>




             The url maps to a web script
              • URL = /blocks/image

             The properties of the component are fed into the Web
             Script

12/12/08                                                            14
Page Dispatching Logic

             blocks/image is an Image Display component
             The Presentation Web Script fetches data from
             component instance
             var src = instance.properties[“src”];
             if(src != null)‫‏‬
             {
                  // proceed
             }




             The FreeMarker based view then renders the output
             <img src=“${src}” />




12/12/08                                                         15
Page Dispatching Logic

             http://labs3c:8580/alfwf/page?p=home

             The template would execute

               home.ftl
                 SomeImage




12/12/08                                            16
Page Dispatching Logic

             http://labs3c:8580/alfwf/page?p=home

             Generated output




12/12/08                                            17
Page Type Dispatching Logic

             Page Types are used to define a general “class” or
             type of pages
             Examples:
              • Login
              • Profile
              • Others?

             Example: Hitting the login page
              • http://labs3c:8580/alfwf/page?pt=login




12/12/08                                                          18
Page Type Dispatching Logic

             First, see if there is a configured theme
                  Themes can specify overrides for page types
              ●

                  Default themes are specified by site configuration objects
              ●


                  <?xml version='1.0' encoding='UTF-8'?>
                  <theme>
                     <title>Extranet - Enterprise Theme</title>
                     <page-types>
                        <page-type>
                           <id>login</id>
                           <page-instance-id>sample-login</page-instance-id>
                        </page-type>
                     </page-types>
                  </theme>




12/12/08                                                                       19
Page Type Dispatching Logic

             If nothing specifed in a theme, see if the framework
             has a default
              • The web-framework-config*.xml files can specify defaults
                <alfresco-config>
                   <config evaluator=quot;string-comparequot; condition=quot;WebFrameworkquot;>
                      <web-framework>
                         <application-defaults>
                             <theme>newtheme</theme>
                             <page-type>
                                <id>login</id>
                                <page-instance-id>sample-login</page-instance-id>
                             </page-type>
                         </application-defaults>
                      </web-framework>
                   </config>
                </alfresco-config>




12/12/08                                                                            20
Page Type Dispatching Logic

             Last resort, try to use a generic page
              • Looks for a page with id = generic




12/12/08                                              21
Page Type Dispatching Logic

             At this point, we have a page object
             Dispatch to page as before




12/12/08                                            22
Object Dispatching Logic

             Example: Displaying a content object
             http://labs3c:8580/alfwf/page?
             o=workspace://SpacesStore/56923743-7436-482e-b1cf-
             eda326d11dc2
              • Assumes the default endpoint
              • “Load content object with this id from the default endpoint”
             http://labs3c:8580/alfwf/page?
             o=workspace://SpacesStore/56923743-7436-482e-b1cf-
             eda326d11dc2&endpointId=alfresco
              • Uses a specific endpoint
              • “Load content object with this id from the alfresco endpoint”




12/12/08                                                                        23
Object Dispatching Logic

             Look up the ContentLoader implementation
              • A content loader that knows how to load content from this
                endpoint
                <alfresco-config>
                   <config evaluator=quot;string-comparequot; condition=quot;WebFrameworkquot;>
                      <web-framework>
                         <content-loader>
                             <id>alfresco</id>
                             <name>Alfresco Content Loader</name>
                             <class>org.alfresco.web.site.AlfrescoContentLoader</class>
                             <endpoint>alfresco</endpoint>
                         </content-loader>
                      </web-framework>
                   </config>
                </alfresco-config>




12/12/08                                                                                  24
Object Dispatching Logic

             If a ContentLoader is found, then load the object
             Then, look for Content Association instances which
             describe a match for this content object
              • /WEB-INF/classes/alfresco/site-data/content-associations


                <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>

                <content-association>
                  <source-id>{http://www.alfresco.org/model/content/1.0}content</source-id>
                  <dest-id>content-details</dest-id>
                  <assoc-type>page</assoc-type>
                </content-association>




             Describes a page that can be used to display content
             of type: {http://www.alfresco.org/model/content/1.0}content



12/12/08                                                                                 25
Object Dispatching Logic

             At this point, we have a page object
             Dispatch to page as before




12/12/08                                            26
Site Data

           /WEB-INF/classes/alfresco

              /site-data


                /chrome
                /components
                /component-types
                /configurations
                /content-associations
                /page-associations
                /pages
                /page-types
                /template-instances
                /template-types
                /themes
12/12/08                                27
Components

           /WEB-INF/classes/alfresco

             /site-webscripts
                /example


                  /component.get.desc.xml
                  /component.get.js
                  /component.get.html.ftl
                  /component.get.head.ftl
                  /component.get.properties
                  /component.get.config




12/12/08                                      28
Templates

           /WEB-INF/classes/alfresco

             /templates
                /example


                  /template.js
                  /template.ftl
                  /template.head.ftl




12/12/08                               29
Wrap-up

                In this module, you learned...
                     • How Surf model objects inter-relate
                     • Three ways pages are dispatched
                               – Specific page
                               – Page type
                         – Object
                     • Pages are assembled by invoking component renderers




12/12/08   Optaros and Client confidential. All rights reserved.             30

More Related Content

What's hot

Intro To Sap Netweaver Java
Intro To Sap Netweaver JavaIntro To Sap Netweaver Java
Intro To Sap Netweaver Java
Leland Bartlett
 
Csajsp Chapter15
Csajsp Chapter15Csajsp Chapter15
Csajsp Chapter15
Adil Jafri
 

What's hot (20)

Intro To Sap Netweaver Java
Intro To Sap Netweaver JavaIntro To Sap Netweaver Java
Intro To Sap Netweaver Java
 
Orbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case StudyOrbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case Study
 
Spring 3 - Der dritte Frühling
Spring 3 - Der dritte FrühlingSpring 3 - Der dritte Frühling
Spring 3 - Der dritte Frühling
 
Web Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaosWeb Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaos
 
BP-6 Repository Customization Best Practices
BP-6 Repository Customization Best PracticesBP-6 Repository Customization Best Practices
BP-6 Repository Customization Best Practices
 
Dethroning Grunt: Simple and Effective Builds with gulp.js
Dethroning Grunt: Simple and Effective Builds with gulp.jsDethroning Grunt: Simple and Effective Builds with gulp.js
Dethroning Grunt: Simple and Effective Builds with gulp.js
 
Jsf Ajax
Jsf AjaxJsf Ajax
Jsf Ajax
 
Jlook web ui framework
Jlook web ui frameworkJlook web ui framework
Jlook web ui framework
 
Html 5 in a big nutshell
Html 5 in a big nutshellHtml 5 in a big nutshell
Html 5 in a big nutshell
 
Introduction To Web Beans
Introduction To Web BeansIntroduction To Web Beans
Introduction To Web Beans
 
Django Architecture Introduction
Django Architecture IntroductionDjango Architecture Introduction
Django Architecture Introduction
 
Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3Introducing Assetic: Asset Management for PHP 5.3
Introducing Assetic: Asset Management for PHP 5.3
 
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJRealize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
 
Advanced Fluid
Advanced FluidAdvanced Fluid
Advanced Fluid
 
企业级软件的组件化和动态化开发实践
企业级软件的组件化和动态化开发实践企业级软件的组件化和动态化开发实践
企业级软件的组件化和动态化开发实践
 
Symfony2 and AngularJS
Symfony2 and AngularJSSymfony2 and AngularJS
Symfony2 and AngularJS
 
JSP - Part 2 (Final)
JSP - Part 2 (Final) JSP - Part 2 (Final)
JSP - Part 2 (Final)
 
Maven II
Maven IIMaven II
Maven II
 
Csajsp Chapter15
Csajsp Chapter15Csajsp Chapter15
Csajsp Chapter15
 
PHP & MVC
PHP & MVCPHP & MVC
PHP & MVC
 

Similar to Optaros Surf Code Camp Dispatcher

FatWire Tutorial For Site Studio Developers
FatWire Tutorial For Site Studio DevelopersFatWire Tutorial For Site Studio Developers
FatWire Tutorial For Site Studio Developers
Brian Huff
 
[Muir] Seam 2 in practice
[Muir] Seam 2 in practice[Muir] Seam 2 in practice
[Muir] Seam 2 in practice
javablend
 
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts ApplicationStep by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Application
elliando dias
 
Building Websites Using ASP.NET Core Razor Pages
Building Websites Using ASP.NET Core Razor PagesBuilding Websites Using ASP.NET Core Razor Pages
Building Websites Using ASP.NET Core Razor Pages
ssusere19c741
 

Similar to Optaros Surf Code Camp Dispatcher (20)

Optaros Surf Code Camp Walkthrough 1
Optaros Surf Code Camp Walkthrough 1Optaros Surf Code Camp Walkthrough 1
Optaros Surf Code Camp Walkthrough 1
 
FatWire Tutorial For Site Studio Developers
FatWire Tutorial For Site Studio DevelopersFatWire Tutorial For Site Studio Developers
FatWire Tutorial For Site Studio Developers
 
[Muir] Seam 2 in practice
[Muir] Seam 2 in practice[Muir] Seam 2 in practice
[Muir] Seam 2 in practice
 
Optaros Surf Code Camp Api
Optaros Surf Code Camp ApiOptaros Surf Code Camp Api
Optaros Surf Code Camp Api
 
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts ApplicationStep by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Application
 
Seamless Integrations between WebCenter Content, Site Studio, and WebCenter S...
Seamless Integrations between WebCenter Content, Site Studio, and WebCenter S...Seamless Integrations between WebCenter Content, Site Studio, and WebCenter S...
Seamless Integrations between WebCenter Content, Site Studio, and WebCenter S...
 
T5 Oli Aro
T5 Oli AroT5 Oli Aro
T5 Oli Aro
 
More object oriented development with Page Type Builder
More object oriented development with Page Type BuilderMore object oriented development with Page Type Builder
More object oriented development with Page Type Builder
 
Exploring Critical Rendering Path
Exploring Critical Rendering PathExploring Critical Rendering Path
Exploring Critical Rendering Path
 
Leveraging the Power of Custom Elements in Gutenberg
Leveraging the Power of Custom Elements in GutenbergLeveraging the Power of Custom Elements in Gutenberg
Leveraging the Power of Custom Elements in Gutenberg
 
Building Websites Using ASP.NET Core Razor Pages
Building Websites Using ASP.NET Core Razor PagesBuilding Websites Using ASP.NET Core Razor Pages
Building Websites Using ASP.NET Core Razor Pages
 
Modelibra Software Family
Modelibra Software FamilyModelibra Software Family
Modelibra Software Family
 
Moving from AS3 to Flex - advantages, hazards, traps
Moving from AS3 to Flex - advantages, hazards, trapsMoving from AS3 to Flex - advantages, hazards, traps
Moving from AS3 to Flex - advantages, hazards, traps
 
웹을 지탱하는 차세대 기술 @한국웹20주년 컨퍼런스
웹을 지탱하는 차세대 기술 @한국웹20주년 컨퍼런스웹을 지탱하는 차세대 기술 @한국웹20주년 컨퍼런스
웹을 지탱하는 차세대 기술 @한국웹20주년 컨퍼런스
 
The War on ActionView with Russian Doll Caching
The War on ActionView with Russian Doll CachingThe War on ActionView with Russian Doll Caching
The War on ActionView with Russian Doll Caching
 
Building Your First Store App with XAML and C#
Building Your First Store App with XAML and C#Building Your First Store App with XAML and C#
Building Your First Store App with XAML and C#
 
Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016Web Development with Delphi and React - ITDevCon 2016
Web Development with Delphi and React - ITDevCon 2016
 
Lightning web components - Introduction, component Lifecycle, Events, decorat...
Lightning web components - Introduction, component Lifecycle, Events, decorat...Lightning web components - Introduction, component Lifecycle, Events, decorat...
Lightning web components - Introduction, component Lifecycle, Events, decorat...
 
Introduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformIntroduction to Alfresco Surf Platform
Introduction to Alfresco Surf Platform
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applications
 

More from Jeff Potts

Alfresco Community Survey 2012 Results
Alfresco Community Survey 2012 ResultsAlfresco Community Survey 2012 Results
Alfresco Community Survey 2012 Results
Jeff Potts
 

More from Jeff Potts (20)

No Docker? No Problem: Automating installation and config with Ansible
No Docker? No Problem: Automating installation and config with AnsibleNo Docker? No Problem: Automating installation and config with Ansible
No Docker? No Problem: Automating installation and config with Ansible
 
Moving From Actions & Behaviors to Microservices
Moving From Actions & Behaviors to MicroservicesMoving From Actions & Behaviors to Microservices
Moving From Actions & Behaviors to Microservices
 
Flexible Permissions Management with ACL Templates
Flexible Permissions Management with ACL TemplatesFlexible Permissions Management with ACL Templates
Flexible Permissions Management with ACL Templates
 
Moving Gigantic Files Into and Out of the Alfresco Repository
Moving Gigantic Files Into and Out of the Alfresco RepositoryMoving Gigantic Files Into and Out of the Alfresco Repository
Moving Gigantic Files Into and Out of the Alfresco Repository
 
Could Alfresco Survive a Zombie Attack?
Could Alfresco Survive a Zombie Attack?Could Alfresco Survive a Zombie Attack?
Could Alfresco Survive a Zombie Attack?
 
Connecting Content Management Apps with CMIS
Connecting Content Management Apps with CMISConnecting Content Management Apps with CMIS
Connecting Content Management Apps with CMIS
 
The Challenges of Keeping Bees
The Challenges of Keeping BeesThe Challenges of Keeping Bees
The Challenges of Keeping Bees
 
Getting Started With CMIS
Getting Started With CMISGetting Started With CMIS
Getting Started With CMIS
 
Alfresco: What every developer should know
Alfresco: What every developer should knowAlfresco: What every developer should know
Alfresco: What every developer should know
 
CMIS: An Open API for Managing Content
CMIS: An Open API for Managing ContentCMIS: An Open API for Managing Content
CMIS: An Open API for Managing Content
 
Apache Chemistry in Action: Using CMIS and your favorite language to unlock c...
Apache Chemistry in Action: Using CMIS and your favorite language to unlock c...Apache Chemistry in Action: Using CMIS and your favorite language to unlock c...
Apache Chemistry in Action: Using CMIS and your favorite language to unlock c...
 
Alfresco: The Story of How Open Source Disrupted the ECM Market
Alfresco: The Story of How Open Source Disrupted the ECM MarketAlfresco: The Story of How Open Source Disrupted the ECM Market
Alfresco: The Story of How Open Source Disrupted the ECM Market
 
Join the Alfresco community
Join the Alfresco communityJoin the Alfresco community
Join the Alfresco community
 
Intro to the Alfresco Public API
Intro to the Alfresco Public APIIntro to the Alfresco Public API
Intro to the Alfresco Public API
 
Apache Chemistry in Action
Apache Chemistry in ActionApache Chemistry in Action
Apache Chemistry in Action
 
Building Content-Rich Java Apps in the Cloud with the Alfresco API
Building Content-Rich Java Apps in the Cloud with the Alfresco APIBuilding Content-Rich Java Apps in the Cloud with the Alfresco API
Building Content-Rich Java Apps in the Cloud with the Alfresco API
 
Alfresco Community Survey 2012 Results
Alfresco Community Survey 2012 ResultsAlfresco Community Survey 2012 Results
Alfresco Community Survey 2012 Results
 
Getting Started with CMIS
Getting Started with CMISGetting Started with CMIS
Getting Started with CMIS
 
Relational Won't Cut It: Architecting Content Centric Apps
Relational Won't Cut It: Architecting Content Centric AppsRelational Won't Cut It: Architecting Content Centric Apps
Relational Won't Cut It: Architecting Content Centric Apps
 
Alfresco SAUG: State of ECM
Alfresco SAUG: State of ECMAlfresco SAUG: State of ECM
Alfresco SAUG: State of ECM
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 

Optaros Surf Code Camp Dispatcher

  • 1. Alfresco Surf Code Camp Dispatcher and Site Construction
  • 2. Objectives By the end of this module you should know • How pages are dispatched • How pages are assembled by invoking component renderers • How Page Types & Themes work together 12/12/08 Optaros and Client confidential. All rights reserved. 2
  • 3. Site Dispatcher You've used web script-based components as Share Dashlets Now let's learn about how Surf sites and Surf pages are built 12/12/08 3
  • 4. Site Dispatcher The site dispatcher is responsible for figuring out which page should be assembled for a given request, and then assembling the page by invoking renderers Page Renderer Renderer Renderer Renderer 12/12/08 4
  • 5. Model Objects Model Objects contain information about site construction A web site looks to these objects during render They define pages and page layout They define where components appear on pages 12/12/08 5
  • 6. Model Objects Model Objects are XML files Here is an example of a component XML file <?xml version='1.0' encoding='UTF-8'?> <component> <scope>global</scope> <region-id>footer</region-id> <source-id>global</source-id> <url>/age/footer</url> <properties> <custom1>My custom property value</custom1> </properties> </component> 12/12/08 6
  • 7. List of Model Objects Types Associations Component Type Page • Association Template Type Content • Page Type Association Instances Site Component Configuration • • Template Theme • • Instance Chrome • Page • 12/12/08 7
  • 8. Key Surf Page Construction Concepts SomeTemplate.ftl Pages Home Header Blog About Gutter Body Template Instances & Regions Renderers Footer Component (Web Script) 12/12/08 Optaros and Client confidential. All rights reserved. 8
  • 9. Model Objects Graph Page Page Page Type Association Template Template Content Type Instance Association Component Component Chrome Type Configuration Theme 12/12/08 9
  • 10. Dispatching Regardless of the path, it always comes down to a Page • An Object is requested -> What page should display it? • A Page Type is requested -> Which page is appropriate for this Theme? • A specific Page is requested URI Resolves to a page Servlet Page Type Requests To Rendering Dispatcher Page Servlet Object Resolves to a page 12/12/08 10
  • 11. Page Dispatching Logic 1. Example: Hitting the home page http://labs3c:8580/alfwf/page?p=home  2. Look up Page (in /site-data/pages)‫‏‬ Page has a template instance.  3. Look up Template Instance (in /site-data/template- instances)‫‏‬ 4. Look up Renderer for Template In this case the Renderer is a FreeMarker Template  Process regions on page by id  5. Find Component Bindings for those region ids 6. Look up Components (in /site-data/components)‫‏‬ 12/12/08 11
  • 12. Page Dispatching Logic Look up the page object by page id: home • /WEB-INF/classes/alfresco/site-data/pages <?xml version='1.0' encoding='UTF-8'?> <page> <title>Home Page</title> <template-instance>home</template-instance> <authentication>none</authentication> </page> Look up the template by template id: home • /WEB-INF/classes/alfresco/site-data/template-instances <?xml version='1.0' encoding='UTF-8'?> <template-instance> <template-type>freemarker</template-type> <url>/sample/home</url> </template-instance> OR Potentially <?xml version='1.0' encoding='UTF-8'?> confusing <template-instance> shortcut here! <template-type>/sample/home</template-type> </template-instance> 12/12/08 12
  • 13. Page Dispatching Logic Execute the Template Renderer for path: /sample/home • FreeMarker renderer • /WEB-INF/classes/alfresco/templates/sample/home.ftl <html> <body> <@region id=“SomeImage” scope=“page” /> </body> </html> Execute the region tag and find matching components • /WEB-INF/classes/alfresco/site-data/components • Search for components in page scope, bound to home page for the region ‘SomeImage’ Components have a naming • page.test.home.xml convention which is duplicative of the XML it contains. Currently, the XML page, scope, and region XML are ignored, but in the future, the naming convention will be dropped. 12/12/08 13
  • 14. Page Dispatching Logic Analyze the Component and prepare to render it • /WEB-INF/classes/alfresco/site-data/components <?xml version='1.0' encoding='UTF-8'?> <component> <scope>page</scope> <region-id>SomeImage</region-id> <source-id>home</source-id> <url>/blocks/image</url> <properties> <src>${url.context}/images/masay.jpg</src> </properties> </component> The url maps to a web script • URL = /blocks/image The properties of the component are fed into the Web Script 12/12/08 14
  • 15. Page Dispatching Logic blocks/image is an Image Display component The Presentation Web Script fetches data from component instance var src = instance.properties[“src”]; if(src != null)‫‏‬ { // proceed } The FreeMarker based view then renders the output <img src=“${src}” /> 12/12/08 15
  • 16. Page Dispatching Logic http://labs3c:8580/alfwf/page?p=home The template would execute home.ftl SomeImage 12/12/08 16
  • 17. Page Dispatching Logic http://labs3c:8580/alfwf/page?p=home Generated output 12/12/08 17
  • 18. Page Type Dispatching Logic Page Types are used to define a general “class” or type of pages Examples: • Login • Profile • Others? Example: Hitting the login page • http://labs3c:8580/alfwf/page?pt=login 12/12/08 18
  • 19. Page Type Dispatching Logic First, see if there is a configured theme Themes can specify overrides for page types ● Default themes are specified by site configuration objects ● <?xml version='1.0' encoding='UTF-8'?> <theme> <title>Extranet - Enterprise Theme</title> <page-types> <page-type> <id>login</id> <page-instance-id>sample-login</page-instance-id> </page-type> </page-types> </theme> 12/12/08 19
  • 20. Page Type Dispatching Logic If nothing specifed in a theme, see if the framework has a default • The web-framework-config*.xml files can specify defaults <alfresco-config> <config evaluator=quot;string-comparequot; condition=quot;WebFrameworkquot;> <web-framework> <application-defaults> <theme>newtheme</theme> <page-type> <id>login</id> <page-instance-id>sample-login</page-instance-id> </page-type> </application-defaults> </web-framework> </config> </alfresco-config> 12/12/08 20
  • 21. Page Type Dispatching Logic Last resort, try to use a generic page • Looks for a page with id = generic 12/12/08 21
  • 22. Page Type Dispatching Logic At this point, we have a page object Dispatch to page as before 12/12/08 22
  • 23. Object Dispatching Logic Example: Displaying a content object http://labs3c:8580/alfwf/page? o=workspace://SpacesStore/56923743-7436-482e-b1cf- eda326d11dc2 • Assumes the default endpoint • “Load content object with this id from the default endpoint” http://labs3c:8580/alfwf/page? o=workspace://SpacesStore/56923743-7436-482e-b1cf- eda326d11dc2&endpointId=alfresco • Uses a specific endpoint • “Load content object with this id from the alfresco endpoint” 12/12/08 23
  • 24. Object Dispatching Logic Look up the ContentLoader implementation • A content loader that knows how to load content from this endpoint <alfresco-config> <config evaluator=quot;string-comparequot; condition=quot;WebFrameworkquot;> <web-framework> <content-loader> <id>alfresco</id> <name>Alfresco Content Loader</name> <class>org.alfresco.web.site.AlfrescoContentLoader</class> <endpoint>alfresco</endpoint> </content-loader> </web-framework> </config> </alfresco-config> 12/12/08 24
  • 25. Object Dispatching Logic If a ContentLoader is found, then load the object Then, look for Content Association instances which describe a match for this content object • /WEB-INF/classes/alfresco/site-data/content-associations <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <content-association> <source-id>{http://www.alfresco.org/model/content/1.0}content</source-id> <dest-id>content-details</dest-id> <assoc-type>page</assoc-type> </content-association> Describes a page that can be used to display content of type: {http://www.alfresco.org/model/content/1.0}content 12/12/08 25
  • 26. Object Dispatching Logic At this point, we have a page object Dispatch to page as before 12/12/08 26
  • 27. Site Data /WEB-INF/classes/alfresco /site-data /chrome /components /component-types /configurations /content-associations /page-associations /pages /page-types /template-instances /template-types /themes 12/12/08 27
  • 28. Components /WEB-INF/classes/alfresco /site-webscripts /example /component.get.desc.xml /component.get.js /component.get.html.ftl /component.get.head.ftl /component.get.properties /component.get.config 12/12/08 28
  • 29. Templates /WEB-INF/classes/alfresco /templates /example /template.js /template.ftl /template.head.ftl 12/12/08 29
  • 30. Wrap-up In this module, you learned... • How Surf model objects inter-relate • Three ways pages are dispatched – Specific page – Page type – Object • Pages are assembled by invoking component renderers 12/12/08 Optaros and Client confidential. All rights reserved. 30