20
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

Implementing portlets using Web Scripts

Embed Size (px)

Citation preview

Page 1: 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

Page 2: Implementing portlets using Web Scripts

What is a portal?

Page 3: Implementing portlets using Web Scripts

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

Page 4: Implementing portlets using Web Scripts

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

Page 5: Implementing portlets using Web Scripts

Why exposing WebScripts as portlets?

• Agile and quick approach• Reuse of existing components• Modularization• It’s fun ^__^

Page 6: Implementing portlets using Web Scripts

Exposing WebScripts as portlets

WebScriptPortlet• alfresco.war

• WebScripts

Pure Spring WebScripts

ProxyPortlet• share.war

• Surf pages• Surf components

• WebScripts

Spring Surf

Page 7: Implementing portlets using Web Scripts

Spring WebScripts framework

Page 8: Implementing portlets using Web Scripts

WebScriptPortlet – Deployment scenario

WebScriptPortlet• JVM

• Portal

• alfresco.war• portlet.xml

• Presentation• Take contents directly

from the local Alfresco

• Single tier architecture

JVMPortal

Alfresco

Page 9: Implementing portlets using Web Scripts

WebScriptPortlet – Parameters

• scriptUrl• URL of the WebScript

• Authenticator factory• jsr168.webclient

• Cookie• jsr168

• Portal session

Page 10: Implementing portlets using Web Scripts

WebScriptPortlet – Portlet descriptor

Page 11: Implementing portlets using Web Scripts

WebScriptPortlet – Rendering in the portal

Page 12: Implementing portlets using Web Scripts

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

Page 13: Implementing portlets using Web Scripts

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!!!

Page 14: Implementing portlets using Web Scripts

ProxyPortlet – Spring Surf architecture

Page 15: Implementing portlets using Web Scripts

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

Page 16: Implementing portlets using Web Scripts

ProxyPortlet – Parameters

viewScriptUrl• URL related to

• Surf page• Surf component

Page 17: Implementing portlets using Web Scripts

ProxyPortlet – Rendering in the portal

Page 18: Implementing portlets using Web Scripts

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

Page 19: Implementing portlets using Web Scripts

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!!!