SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Introduction to Java Standard Portlets
R O H A N FAY E

1
Contents
World before portlets
A typical JSP based architecture
Limitations with application based on Servlets / JSP
Rise of portals – the introduction
Portal and Portlets
Examples
Advantages

Portlet Lifecycle

2
Contents (contd.)
Portlets Request and Response
Java Portlet Specification
Portlet modes and window states
Portlet filters
Inter Portlet Communication
Code Walkthrough
Q&A

References

3
World before portlets
Conventional approach
Static HTML
Dynamic web applications
◦ Servlets and JSP technologies

Examples

4
A typical JSP based Architecture

5
Limitations with application based on Servlets / JSP
Following are the notable drawbacks of the Servlets and JSP based web
applications:
User can view and has access to the single web application at a time
Lack of content aggregation

Limitations to the content configuration and customization per user
Lack of different application modes
Lack of Window states support

6
So how to deal with
this? Are we not at our
best in the business??

7
Rise of portals – the introduction
Need of a real application, which itself will act as a base engine
Container for other integrated applications
Secure and robust API
Cost effective
Developer friendly
Ease of use

8
What is a portal?
A portal is designed to be a single web-based environment from which
all of a user’s applications can run, and these applications are integrated
together in a consistent and systematic way.

9
Gotcha! Then what is a portlet?
Portlets are pluggable user interface software components that are
managed and displayed in a web portal.
Produce fragments of markup code that are aggregated into a portal.
Displayed as a collection of non-overlapping portlet windows, where
each portlet window displays a portlet
Resembles a web-based application that is hosted in a portal.
Portlet standards are intended to enable software developers to create
portlets that can be plugged into any portal supporting the standards.

10
For example…

11
Advantages
Portlets have additional characteristics that make them different from
Servlets.
Portlet Modes
Window States
Portlet Preferences
Standard Inter Portlet Communication (IPC)
◦ Public Render Parameter
◦ Events

Resource Serving

◦ AJAX Support
◦ Binary data support

Portlet Filters

12
Wonderful! This will
definitely enhance the way
we do business and attract
more customers!!!
I smell money… $$$

13
Portlet lifecycle
init() : Initializes the portlet
render() : Renders the content
processAction() : Called when the user performs the action
processEvent() : Called when an event has been triggered
serveResource() : Called when a ResourceURL is requested
Destroy() : Releases the portlet object so it is eligible for garbage
collection.

14
Portlet lifecycle (contd.)
init phase – The init() method is called by the Liferay portlet container
during the deployment of the project. This method is typically used to
read initialization parameters from the portlet.xml.
Render phase – During the Render phase, the portlet generates content
based on its current state. The Render phase is called on all of the
portlets on a page when that page is rendered. Portlets typically enter
the Render phase as a result of page refresh or after the completion of
the Action phase.
Action phase – The portlet enters the Action phase as a result of the
user interacting with that portlet. Specifically, the user interaction
should result in a change of the state in the portal. Only one portlet can
go through the Action phase during single request/response cycle.

15
Portlet lifecycle (contd.)
Event phase – The Event phase is used to process any Events triggered
during the Action phase of the portlet lifecycle. Events are used for Inter
Portlet Communication (IPC).
Resource Serving phase – This phase allows portlets to serve dynamic
content without the need calling the Render phase on all the portlets
on the page. In Portlet 1.0, portlet requests always returned a full portal
page.
Destroy phase – This method gets called by the Liferay portlet
container when it is removed from service. This phase allow to release
any resources.

16
Portlet Request and Response

17
Java Portlet Specification
The Java Portlet Specification defines a contract between the portlet
container and portlets and provides a convenient programming model
for Java portlet developers.
◦ JSR 168
◦ JSR 286

18
JSR 168 (Portlet 1.0)
The Java Portlet Specification V1.0 introduces the basic portlet programming model with:
Two phases of action processing and rendering in order to support the Model-ViewController pattern.
Portlet modes, enabling the portal to advise the portlet what task it should perform and
what content it should generate
Window states, indicating the amount of portal page space that will be assigned to the
content generated by the portlet
Portlet data model, allowing the portlet to store view information in the render
parameters, session related information in the portlet session and per user persistent data
in the portlet preferences
A packaging format in order to group different portlets and other Java EE artifacts needed
by these portlets into one portlet application which can be deployed on the portal server.

Portal development is a way to integrate the different web-based applications for
supporting deliveries of information and services.

19
JSR 286 (Portlet 2.0)
It was developed to improve on the short-comings on version 1.0 of the
specification, JSR-168. Some of its major features include:
Inter-Portlet Communication through events and public render
parameters

Serving dynamically generated resources directly through portlets
Serving AJAX or JSON data directly through portlets
Introduction of portlet filters and listeners

20
Portlet Modes
Each portlet has a current mode, which indicates the function the portlet is
performing
All Java Standard compliant portals must support the View, Edit and Help
modes.
Portlet modes are defined in the portlet.xml file.

Custom modes may be created by developers.
View Mode – Typical portlet is first rendered in View Mode.
Edit Mode – When the user clicks on the “Preferences” icon, the portlets
switches to Edit mode.
Help Mode – When the user clicks on the Help icon, the portlet switches to
Help Mode.

21
Window States
Window States indicate the amount of space that will be assigned to a portlet.
All Java Standards compliant must support minimized, maximized and normal.

Minimized Window State – When the user clicks on the Minimize icon, only the
portlet titlebar is displayed.
Maximized Window State – When the user clicks on the Maximize icon, the portlet
will take up the entire width of the page, and become the only portlet rendered on
the page.
Remove Window – When the user clicks on the Remove icon, the portlet is removed
form the page.

22
Portlet Filters
Filters are Java components that allow on the fly transformations of
information in both the request to and the response from a portlet.
They allow chaining reusable functionality before or after any phase of
the portlet Lifecycle:
◦
◦
◦
◦

processAction
processEvent
serveResource
render

Modeled after the filters of the Servlet specification

23
IPC (Inter Portlet Communication)
Inter-portlet communication (IPC) is a technique whereby two or more
portlets on a portal page share data in some way.
In a typical IPC use case, user interactions with one portlet affect the
rendered markup of another portlet.

24
IPC - Importance
IPC becomes important with Portlet applications which are composed of
more than one portlet for their functionality.
Consider a banking application with one portlet at the top screen which
allows users to search for customers.

When a customer is selected, a portlet on the bottom of the screen
shows a list of that customer’s information and associated bank
accounts.
With IPC this functionality can be done in a standard way-and the two
portlets don’t even need to be on the same portlet page.

25
Achieving IPC
The Portlet 2.0 standard provides two techniques to achieve Inter
portlet Communication :
◦ Public Render Parameters
◦ Server-Side Events

26
Public Render Parameters
The Simplest method for developer to perform standard IPC.
A developer can declare a list of public render parameters for a portlet
application in portlet.xml:
The parameter names are namespaced to avoid naming conflicts..
</portlet-app>
<public-render-parameter>
<identifier>foo</identifier>
<qname xmlns:x="http://foo.com/p">x:foo2</qname>
</public-render-parameter>
.
.
</portlet-app>

27
Public Render Parameters (contd.)
Portlets must declare which public render parameters they want to read
by using supported public-render-parameter element :
<portlet>
<portlet-name>Portlet A</ portlet-name><
<supported-public-render-parameter>
foo
</supported-public-render-parameter>
</portlet>

28
Public Render Parameters (contd.)
A portlet can read a public render parameter by using:
◦ request.getPublicParameterMap()

Public parameters are merged with regular parameters so
can also be read using:
◦ getParameter(name)
◦ getParameterMap()

A portlet can remove public render parameter by invoking:
◦ response.removePublicRenderParameter (name)

◦ portletURLremovePublicRenderParameter (name)

29
Server-Side Events
Very powerful and highly decoupled method for IPC.
Uses a producer-listener pattern.
◦ One portlet generates an event.
◦ Other portlets may be listening and acting upon it.

Allows communication between portlets in different applications.
Additionally the container may also generate its own events.
◦ No Specific container has been standardized yet.

But beware of the added complexity.

30
Server-Side Events (contd.)
Portlets can publish events from its processAction code.
Publishing an event causes one or more invocations of the new
processEvent method in this or other portlets.
From the implementation of processEvents new events may also be
published .
Note that there is no guarantee in the order of delivery of events.

31
Code walkthrough

32
Questions, comments or suggestions?

33
Thank You!
References:
Liferay in Action – Manning
http://en.wikipedia.org/wiki/Java_Portlet_Specification
http://www.developer.com/java/web/article.php/3891786/Portlets-vsServlets-Request-Processing-with-Web-Components.htm

34

Weitere ähnliche Inhalte

Was ist angesagt?

Les architectures client serveur
Les architectures client serveurLes architectures client serveur
Les architectures client serveurAmeni Ouertani
 
Services web rest_support_cours_nfaoui_el_habib
Services web rest_support_cours_nfaoui_el_habibServices web rest_support_cours_nfaoui_el_habib
Services web rest_support_cours_nfaoui_el_habibEl Habib NFAOUI
 
Liferay overview
Liferay overviewLiferay overview
Liferay overviewAbhishekSRC
 
eServices-Tp1: Web Services
eServices-Tp1: Web ServiceseServices-Tp1: Web Services
eServices-Tp1: Web ServicesLilia Sfaxi
 
Spring Framework Petclinic sample application
Spring Framework Petclinic sample applicationSpring Framework Petclinic sample application
Spring Framework Petclinic sample applicationAntoine Rey
 
Selenium Tutorial Java
Selenium Tutorial  JavaSelenium Tutorial  Java
Selenium Tutorial JavaAhmed HARRAK
 
Angular Framework présentation PPT LIGHT
Angular Framework présentation PPT LIGHTAngular Framework présentation PPT LIGHT
Angular Framework présentation PPT LIGHTtayebbousfiha1
 
Swagger - make your API accessible
Swagger - make your API accessibleSwagger - make your API accessible
Swagger - make your API accessibleVictor Trakhtenberg
 
Mise en place du Chattoon en PHP
Mise en place du Chattoon en PHPMise en place du Chattoon en PHP
Mise en place du Chattoon en PHPArmel Diamesso
 
Architectures 3-tiers (Web)
Architectures 3-tiers (Web)Architectures 3-tiers (Web)
Architectures 3-tiers (Web)Heithem Abbes
 
Services web soap-el-habib-nfaoui
Services web soap-el-habib-nfaouiServices web soap-el-habib-nfaoui
Services web soap-el-habib-nfaouiEl Habib NFAOUI
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introductionCommit University
 
[125]웹 성능 최적화에 필요한 브라우저의 모든 것
[125]웹 성능 최적화에 필요한 브라우저의 모든 것[125]웹 성능 최적화에 필요한 브라우저의 모든 것
[125]웹 성능 최적화에 필요한 브라우저의 모든 것NAVER D2
 

Was ist angesagt? (20)

Les architectures client serveur
Les architectures client serveurLes architectures client serveur
Les architectures client serveur
 
Services web rest_support_cours_nfaoui_el_habib
Services web rest_support_cours_nfaoui_el_habibServices web rest_support_cours_nfaoui_el_habib
Services web rest_support_cours_nfaoui_el_habib
 
Liferay overview
Liferay overviewLiferay overview
Liferay overview
 
eServices-Tp1: Web Services
eServices-Tp1: Web ServiceseServices-Tp1: Web Services
eServices-Tp1: Web Services
 
Support JEE Spring Inversion de Controle IOC et Spring MVC
Support JEE Spring Inversion de Controle IOC et Spring MVCSupport JEE Spring Inversion de Controle IOC et Spring MVC
Support JEE Spring Inversion de Controle IOC et Spring MVC
 
Spring Framework Petclinic sample application
Spring Framework Petclinic sample applicationSpring Framework Petclinic sample application
Spring Framework Petclinic sample application
 
Selenium Tutorial Java
Selenium Tutorial  JavaSelenium Tutorial  Java
Selenium Tutorial Java
 
Spring Boot RestApi.pptx
Spring Boot RestApi.pptxSpring Boot RestApi.pptx
Spring Boot RestApi.pptx
 
Angular Framework présentation PPT LIGHT
Angular Framework présentation PPT LIGHTAngular Framework présentation PPT LIGHT
Angular Framework présentation PPT LIGHT
 
SOAP-based Web Services
SOAP-based Web ServicesSOAP-based Web Services
SOAP-based Web Services
 
Le langage html
Le langage htmlLe langage html
Le langage html
 
Support de cours Spring M.youssfi
Support de cours Spring  M.youssfiSupport de cours Spring  M.youssfi
Support de cours Spring M.youssfi
 
Swagger - make your API accessible
Swagger - make your API accessibleSwagger - make your API accessible
Swagger - make your API accessible
 
Mise en place du Chattoon en PHP
Mise en place du Chattoon en PHPMise en place du Chattoon en PHP
Mise en place du Chattoon en PHP
 
Architectures 3-tiers (Web)
Architectures 3-tiers (Web)Architectures 3-tiers (Web)
Architectures 3-tiers (Web)
 
Tomcat Server
Tomcat ServerTomcat Server
Tomcat Server
 
Gestion comptes bancaires Spring boot
Gestion comptes bancaires Spring bootGestion comptes bancaires Spring boot
Gestion comptes bancaires Spring boot
 
Services web soap-el-habib-nfaoui
Services web soap-el-habib-nfaouiServices web soap-el-habib-nfaoui
Services web soap-el-habib-nfaoui
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introduction
 
[125]웹 성능 최적화에 필요한 브라우저의 모든 것
[125]웹 성능 최적화에 필요한 브라우저의 모든 것[125]웹 성능 최적화에 필요한 브라우저의 모든 것
[125]웹 성능 최적화에 필요한 브라우저의 모든 것
 

Ähnlich wie Introduction to java standard portlets

Web Application Development
Web Application DevelopmentWeb Application Development
Web Application Developmentriround
 
Portlets 2.0 Tssjs Prague 2008
Portlets 2.0 Tssjs Prague 2008Portlets 2.0 Tssjs Prague 2008
Portlets 2.0 Tssjs Prague 2008SteveMillidge
 
Portets to composite applications
Portets to composite applicationsPortets to composite applications
Portets to composite applicationsSerge Huber
 
Java Portlet 2.0 (JSR 286) Specification
Java Portlet 2.0 (JSR 286) SpecificationJava Portlet 2.0 (JSR 286) Specification
Java Portlet 2.0 (JSR 286) SpecificationJohn Lewis
 
Web Applications Development
Web Applications DevelopmentWeb Applications Development
Web Applications Developmentriround
 
D22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksSunil Patil
 
D22 portlet development with open source frameworks
D22 portlet development with open source frameworksD22 portlet development with open source frameworks
D22 portlet development with open source frameworksSunil Patil
 
Annotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCAnnotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCJohn Lewis
 
Portlets & jsr 168
Portlets & jsr 168Portlets & jsr 168
Portlets & jsr 168grsrkumar
 
Sprint Portlet MVC Seminar
Sprint Portlet MVC SeminarSprint Portlet MVC Seminar
Sprint Portlet MVC SeminarJohn Lewis
 
Jsr286 Cmf2007 c2b2 portal portlet
Jsr286   Cmf2007 c2b2 portal portletJsr286   Cmf2007 c2b2 portal portlet
Jsr286 Cmf2007 c2b2 portal portletSteveMillidge
 
GateIn Introduction
GateIn IntroductionGateIn Introduction
GateIn IntroductionMiro Cupak
 
Developing JSR 286 Portlets
Developing JSR 286 PortletsDeveloping JSR 286 Portlets
Developing JSR 286 PortletsCris Holdorph
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVCJohn Lewis
 
Webcenter Portlal training...
Webcenter Portlal training...Webcenter Portlal training...
Webcenter Portlal training...Vinay Kumar
 
Portlet applications a multi server deployment perspective by mohit kumar(p...
Portlet applications   a multi server deployment perspective by mohit kumar(p...Portlet applications   a multi server deployment perspective by mohit kumar(p...
Portlet applications a multi server deployment perspective by mohit kumar(p...Mohit Kumar
 
Opendelight reference-guide
Opendelight reference-guideOpendelight reference-guide
Opendelight reference-guideAshwini Rath
 
Portlet Bridge
Portlet BridgePortlet Bridge
Portlet BridgeMiro Cupak
 

Ähnlich wie Introduction to java standard portlets (20)

Portlet
PortletPortlet
Portlet
 
Web Application Development
Web Application DevelopmentWeb Application Development
Web Application Development
 
Portal Presention
Portal PresentionPortal Presention
Portal Presention
 
Portlets 2.0 Tssjs Prague 2008
Portlets 2.0 Tssjs Prague 2008Portlets 2.0 Tssjs Prague 2008
Portlets 2.0 Tssjs Prague 2008
 
Portets to composite applications
Portets to composite applicationsPortets to composite applications
Portets to composite applications
 
Java Portlet 2.0 (JSR 286) Specification
Java Portlet 2.0 (JSR 286) SpecificationJava Portlet 2.0 (JSR 286) Specification
Java Portlet 2.0 (JSR 286) Specification
 
Web Applications Development
Web Applications DevelopmentWeb Applications Development
Web Applications Development
 
D22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source FrameworksD22 Portlet Development With Open Source Frameworks
D22 Portlet Development With Open Source Frameworks
 
D22 portlet development with open source frameworks
D22 portlet development with open source frameworksD22 portlet development with open source frameworks
D22 portlet development with open source frameworks
 
Annotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVCAnnotation-Based Spring Portlet MVC
Annotation-Based Spring Portlet MVC
 
Portlets & jsr 168
Portlets & jsr 168Portlets & jsr 168
Portlets & jsr 168
 
Sprint Portlet MVC Seminar
Sprint Portlet MVC SeminarSprint Portlet MVC Seminar
Sprint Portlet MVC Seminar
 
Jsr286 Cmf2007 c2b2 portal portlet
Jsr286   Cmf2007 c2b2 portal portletJsr286   Cmf2007 c2b2 portal portlet
Jsr286 Cmf2007 c2b2 portal portlet
 
GateIn Introduction
GateIn IntroductionGateIn Introduction
GateIn Introduction
 
Developing JSR 286 Portlets
Developing JSR 286 PortletsDeveloping JSR 286 Portlets
Developing JSR 286 Portlets
 
Spring Portlet MVC
Spring Portlet MVCSpring Portlet MVC
Spring Portlet MVC
 
Webcenter Portlal training...
Webcenter Portlal training...Webcenter Portlal training...
Webcenter Portlal training...
 
Portlet applications a multi server deployment perspective by mohit kumar(p...
Portlet applications   a multi server deployment perspective by mohit kumar(p...Portlet applications   a multi server deployment perspective by mohit kumar(p...
Portlet applications a multi server deployment perspective by mohit kumar(p...
 
Opendelight reference-guide
Opendelight reference-guideOpendelight reference-guide
Opendelight reference-guide
 
Portlet Bridge
Portlet BridgePortlet Bridge
Portlet Bridge
 

Kürzlich hochgeladen

Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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 connectorsNanddeep Nachan
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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 REVIEWERMadyBayot
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
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, ...apidays
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
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 WorkerThousandEyes
 

Kürzlich hochgeladen (20)

Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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, ...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
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
 

Introduction to java standard portlets

  • 1. Introduction to Java Standard Portlets R O H A N FAY E 1
  • 2. Contents World before portlets A typical JSP based architecture Limitations with application based on Servlets / JSP Rise of portals – the introduction Portal and Portlets Examples Advantages Portlet Lifecycle 2
  • 3. Contents (contd.) Portlets Request and Response Java Portlet Specification Portlet modes and window states Portlet filters Inter Portlet Communication Code Walkthrough Q&A References 3
  • 4. World before portlets Conventional approach Static HTML Dynamic web applications ◦ Servlets and JSP technologies Examples 4
  • 5. A typical JSP based Architecture 5
  • 6. Limitations with application based on Servlets / JSP Following are the notable drawbacks of the Servlets and JSP based web applications: User can view and has access to the single web application at a time Lack of content aggregation Limitations to the content configuration and customization per user Lack of different application modes Lack of Window states support 6
  • 7. So how to deal with this? Are we not at our best in the business?? 7
  • 8. Rise of portals – the introduction Need of a real application, which itself will act as a base engine Container for other integrated applications Secure and robust API Cost effective Developer friendly Ease of use 8
  • 9. What is a portal? A portal is designed to be a single web-based environment from which all of a user’s applications can run, and these applications are integrated together in a consistent and systematic way. 9
  • 10. Gotcha! Then what is a portlet? Portlets are pluggable user interface software components that are managed and displayed in a web portal. Produce fragments of markup code that are aggregated into a portal. Displayed as a collection of non-overlapping portlet windows, where each portlet window displays a portlet Resembles a web-based application that is hosted in a portal. Portlet standards are intended to enable software developers to create portlets that can be plugged into any portal supporting the standards. 10
  • 12. Advantages Portlets have additional characteristics that make them different from Servlets. Portlet Modes Window States Portlet Preferences Standard Inter Portlet Communication (IPC) ◦ Public Render Parameter ◦ Events Resource Serving ◦ AJAX Support ◦ Binary data support Portlet Filters 12
  • 13. Wonderful! This will definitely enhance the way we do business and attract more customers!!! I smell money… $$$ 13
  • 14. Portlet lifecycle init() : Initializes the portlet render() : Renders the content processAction() : Called when the user performs the action processEvent() : Called when an event has been triggered serveResource() : Called when a ResourceURL is requested Destroy() : Releases the portlet object so it is eligible for garbage collection. 14
  • 15. Portlet lifecycle (contd.) init phase – The init() method is called by the Liferay portlet container during the deployment of the project. This method is typically used to read initialization parameters from the portlet.xml. Render phase – During the Render phase, the portlet generates content based on its current state. The Render phase is called on all of the portlets on a page when that page is rendered. Portlets typically enter the Render phase as a result of page refresh or after the completion of the Action phase. Action phase – The portlet enters the Action phase as a result of the user interacting with that portlet. Specifically, the user interaction should result in a change of the state in the portal. Only one portlet can go through the Action phase during single request/response cycle. 15
  • 16. Portlet lifecycle (contd.) Event phase – The Event phase is used to process any Events triggered during the Action phase of the portlet lifecycle. Events are used for Inter Portlet Communication (IPC). Resource Serving phase – This phase allows portlets to serve dynamic content without the need calling the Render phase on all the portlets on the page. In Portlet 1.0, portlet requests always returned a full portal page. Destroy phase – This method gets called by the Liferay portlet container when it is removed from service. This phase allow to release any resources. 16
  • 17. Portlet Request and Response 17
  • 18. Java Portlet Specification The Java Portlet Specification defines a contract between the portlet container and portlets and provides a convenient programming model for Java portlet developers. ◦ JSR 168 ◦ JSR 286 18
  • 19. JSR 168 (Portlet 1.0) The Java Portlet Specification V1.0 introduces the basic portlet programming model with: Two phases of action processing and rendering in order to support the Model-ViewController pattern. Portlet modes, enabling the portal to advise the portlet what task it should perform and what content it should generate Window states, indicating the amount of portal page space that will be assigned to the content generated by the portlet Portlet data model, allowing the portlet to store view information in the render parameters, session related information in the portlet session and per user persistent data in the portlet preferences A packaging format in order to group different portlets and other Java EE artifacts needed by these portlets into one portlet application which can be deployed on the portal server. Portal development is a way to integrate the different web-based applications for supporting deliveries of information and services. 19
  • 20. JSR 286 (Portlet 2.0) It was developed to improve on the short-comings on version 1.0 of the specification, JSR-168. Some of its major features include: Inter-Portlet Communication through events and public render parameters Serving dynamically generated resources directly through portlets Serving AJAX or JSON data directly through portlets Introduction of portlet filters and listeners 20
  • 21. Portlet Modes Each portlet has a current mode, which indicates the function the portlet is performing All Java Standard compliant portals must support the View, Edit and Help modes. Portlet modes are defined in the portlet.xml file. Custom modes may be created by developers. View Mode – Typical portlet is first rendered in View Mode. Edit Mode – When the user clicks on the “Preferences” icon, the portlets switches to Edit mode. Help Mode – When the user clicks on the Help icon, the portlet switches to Help Mode. 21
  • 22. Window States Window States indicate the amount of space that will be assigned to a portlet. All Java Standards compliant must support minimized, maximized and normal. Minimized Window State – When the user clicks on the Minimize icon, only the portlet titlebar is displayed. Maximized Window State – When the user clicks on the Maximize icon, the portlet will take up the entire width of the page, and become the only portlet rendered on the page. Remove Window – When the user clicks on the Remove icon, the portlet is removed form the page. 22
  • 23. Portlet Filters Filters are Java components that allow on the fly transformations of information in both the request to and the response from a portlet. They allow chaining reusable functionality before or after any phase of the portlet Lifecycle: ◦ ◦ ◦ ◦ processAction processEvent serveResource render Modeled after the filters of the Servlet specification 23
  • 24. IPC (Inter Portlet Communication) Inter-portlet communication (IPC) is a technique whereby two or more portlets on a portal page share data in some way. In a typical IPC use case, user interactions with one portlet affect the rendered markup of another portlet. 24
  • 25. IPC - Importance IPC becomes important with Portlet applications which are composed of more than one portlet for their functionality. Consider a banking application with one portlet at the top screen which allows users to search for customers. When a customer is selected, a portlet on the bottom of the screen shows a list of that customer’s information and associated bank accounts. With IPC this functionality can be done in a standard way-and the two portlets don’t even need to be on the same portlet page. 25
  • 26. Achieving IPC The Portlet 2.0 standard provides two techniques to achieve Inter portlet Communication : ◦ Public Render Parameters ◦ Server-Side Events 26
  • 27. Public Render Parameters The Simplest method for developer to perform standard IPC. A developer can declare a list of public render parameters for a portlet application in portlet.xml: The parameter names are namespaced to avoid naming conflicts.. </portlet-app> <public-render-parameter> <identifier>foo</identifier> <qname xmlns:x="http://foo.com/p">x:foo2</qname> </public-render-parameter> . . </portlet-app> 27
  • 28. Public Render Parameters (contd.) Portlets must declare which public render parameters they want to read by using supported public-render-parameter element : <portlet> <portlet-name>Portlet A</ portlet-name>< <supported-public-render-parameter> foo </supported-public-render-parameter> </portlet> 28
  • 29. Public Render Parameters (contd.) A portlet can read a public render parameter by using: ◦ request.getPublicParameterMap() Public parameters are merged with regular parameters so can also be read using: ◦ getParameter(name) ◦ getParameterMap() A portlet can remove public render parameter by invoking: ◦ response.removePublicRenderParameter (name) ◦ portletURLremovePublicRenderParameter (name) 29
  • 30. Server-Side Events Very powerful and highly decoupled method for IPC. Uses a producer-listener pattern. ◦ One portlet generates an event. ◦ Other portlets may be listening and acting upon it. Allows communication between portlets in different applications. Additionally the container may also generate its own events. ◦ No Specific container has been standardized yet. But beware of the added complexity. 30
  • 31. Server-Side Events (contd.) Portlets can publish events from its processAction code. Publishing an event causes one or more invocations of the new processEvent method in this or other portlets. From the implementation of processEvents new events may also be published . Note that there is no guarantee in the order of delivery of events. 31
  • 33. Questions, comments or suggestions? 33
  • 34. Thank You! References: Liferay in Action – Manning http://en.wikipedia.org/wiki/Java_Portlet_Specification http://www.developer.com/java/web/article.php/3891786/Portlets-vsServlets-Request-Processing-with-Web-Components.htm 34