Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Implementing portlets using Web Scripts

364 views

Published on

This is a lightning talk held during the Alfresco DevCon 2012 in Berlin. An overview about how to implement standard portlets using Web Scripts.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Implementing portlets using Web Scripts

  1. 1. Implementing portlets using WebScripts Piergiorgio Lucidi Open Source ECM Specialist Alfresco Trainer / Wiki Gardener / Contributor Author / Technical Reviewer @ Packt Publishing PMC Member @ Apache Software Foundation Project Leader / Committer @ JBoss
  2. 2. What is a portal?
  3. 3. 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
  4. 4. 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
  5. 5. Why exposing WebScripts as portlets? • Agile and quick approach • Reuse of existing components • Modularization • It’s fun ^__^
  6. 6. Exposing WebScripts as portlets WebScriptPortlet • alfresco.war • WebScripts Pure Spring WebScripts ProxyPortlet • share.war • Surf pages • Surf components • WebScripts Spring Surf
  7. 7. Spring WebScripts framework
  8. 8. WebScriptPortlet – Deployment scenario WebScriptPortlet • JVM • Portal • alfresco.war • portlet.xml • Presentation • Take contents directly from the local Alfresco • Single tier architecture JVM Portal Alfresco
  9. 9. WebScriptPortlet – Parameters • scriptUrl • URL of the WebScript • Authenticator factory • jsr168.webclient • Cookie • jsr168 • Portal session
  10. 10. WebScriptPortlet – Portlet descriptor
  11. 11. WebScriptPortlet – Rendering in the portal
  12. 12. 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
  13. 13. 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!!!
  14. 14. ProxyPortlet – Spring Surf architecture
  15. 15. 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 JVM Portal Share JVM Alfresco
  16. 16. ProxyPortlet – Parameters viewScriptUrl • URL related to • Surf page • Surf component
  17. 17. ProxyPortlet – Rendering in the portal
  18. 18. 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
  19. 19. 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!!!
  20. 20. Thank you! @pjlucidi p.lucidi@sourcesense.com

×