Implementing portlets using Web Scripts
-
Upload
piergiorgio-lucidi -
Category
Technology
-
view
198 -
download
0
Transcript of Implementing portlets using Web Scripts
Implementing portlets using WebScriptsPiergiorgio LucidiOpen Source ECM Specialist
Alfresco Trainer / Wiki Gardener / ContributorAuthor / Technical Reviewer @ Packt PublishingPMC Member @ Apache Software Foundation
Project Leader / Committer @ JBoss
What is a portal?
What is a portal?
• A portal is an application focused on• Aggregating apps based on different technologies• Creating user oriented and dynamic websites• Page-centric approach
• Portlets / Apps / Gadgets
• Enterprise services• Authentication• Authorization• Personalization• Export / Import• APIs for integrations
What is a portlet?
A portlet is an application that•Contains specific business logic
•Provides a fragment of content•Potentially the output fragment can be dynamic for each user
•A permission can be given for•The entire portal•Page•Portlet
•Can be implemented using bridging and wrappers
Why exposing WebScripts as portlets?
• Agile and quick approach• Reuse of existing components• Modularization• It’s fun ^__^
Exposing WebScripts as portlets
WebScriptPortlet• alfresco.war
• WebScripts
Pure Spring WebScripts
ProxyPortlet• share.war
• Surf pages• Surf components
• WebScripts
Spring Surf
Spring WebScripts framework
WebScriptPortlet – Deployment scenario
WebScriptPortlet• JVM
• Portal
• alfresco.war• portlet.xml
• Presentation• Take contents directly
from the local Alfresco
• Single tier architecture
JVMPortal
Alfresco
WebScriptPortlet – Parameters
• scriptUrl• URL of the WebScript
• Authenticator factory• jsr168.webclient
• Cookie• jsr168
• Portal session
WebScriptPortlet – Portlet descriptor
WebScriptPortlet – Rendering in the portal
WebScriptPortlet – How it works
Rendering phases:1. The portal starts to render the page
1. Alfresco starts to render the WebScript
1. Alfresco will authenticate user
1. WebScript is executed using the user permissions
1. The controller will return results in the FTL
1. Alfresco ends to render the WebScript in the portlet
1. The portal finishes to render the page
WebScriptPortlet – Best Practices
• Divide all the functionalities in simple views• Each atomic feature matched with a WebScript
• Use Ajax calls with the ticket session• Any other interaction needed for the WebScript UI
• Don’t overload the WebScript
• Keep it simple!!!
ProxyPortlet – Spring Surf architecture
ProxyPortlet – Deployment scenario
ProxyPortlet• JVM
• Portal
• share.war• portlet.xml
• 2-tiers architecture• Presentation tier
• Share.war
• Data tier• alfresco.war
• Remote calls against the remote repository
JVMPortalShare
JVMAlfresco
ProxyPortlet – Parameters
viewScriptUrl• URL related to
• Surf page• Surf component
ProxyPortlet – Rendering in the portal
ProxyPortlet – How it works
Rendering phases:1. The portal starts to render the page
1. Share starts to render the Surf page
1. Surf starts to render the component
1. Share invokes Alfresco using external authentication
1. Alfresco executes the Data WebScript
1. The returned JSON will be used in the FTL
1. Share ends to render the Surf page
1. The portal finishes to render the portlet
ProxyPortlet – Best Practices
• Configure SSO between Alfresco and the portal• External authentication
• Each request from Share will have an HTTP header• Alfresco will delegate the portal for authentication
• Divide each functionality thinking about usability
• Use Ajax calls for creating dynamic UI
• Don’t overload Surf pages and components
• Keep it simple!!!