Download presentation
Presentation is loading. Please wait.
1
How Do You Implement Them?
What are Portlets and How Do You Implement Them? Rima Patel Sriganesh Technology Evangelist Sun Microsystems, Inc.
2
Obectives Introduce Portlet components
Provide information on various Portlet standards efforts Provide a basic how-to understanding about implementing Portlet components
3
Agenda Introduction to Portals and Portlets Portlet Standards
JSR 168 Portlet Specification WSRP Web Services for Remote Portals Sample implemenation of a HelloWorld Portlet Resources
4
Agenda Introduction to Portals and Portlets Portlet Standards
JSR 168 Portlet Specification WSRP Web Services for Remote Portals Sample implemenation of a HelloWorld Portlet Resources
5
Portals Portals are becoming a platform for
Integration Aggregation Delivery of applications and content through different channels and devices Portals are common entry point for accessing applications and content
6
Portal Functions Typical portal functions
Authentication and Authorization Personalization Customization Searching User relationship management Registration, Profile management, etc. Single sign-on Etc.
7
Portal example
8
Portlets Portals comprises of components called Portlets
Alike web components such as Servlets with special properties Each Portlet produces a markup fragment that is combined with markup generated by other portlets, all within a portal page markup Designed to be aggregatable in larger context of a portal page
9
Portlet Context Managed by host Portal
Provides information pertaining to User profile Individual portlet instance data Portlet settings UI related Portlet Window State (Min, Max, etc.) Portlet Modes (View, edit, configuration, help, etc.) Portlet Events (actions)
10
Portlet example If clicked on Edit, Portlet would generate appropriate EVENT and Perform appropriate ACTION UI related settings * Portlet is currently in View mode * Many such portlet components are invoked in a single request for a Portal page
11
Positioning of Portlet
An important Service Delivery architectural component Other Service Delivery architectural components Java Server Pages (JSPTM) Application Frameworks Iplanet JATO/JSF (JSR 127) Struts, etc.
12
Agenda Introduction to Portals and Portlets Portlet Standards
JSR 168 Portlet Specification WSRP Web Services for Remote Portals Sample implemenation of a HelloWorld Portlet Resources
13
JSR 168 Portlet Specification
Aims towards Enabling interoperability between Portals and Portlets Defining a set of APIs for addressing different areas of Portal computing Aggregation Personalization Presentation Security Based on JavaTM Servlet API
14
JSR 168 Portlet Invocation Model
Portal Page Servlet EJBs Action Local Portlet Connectors Local Portlet J2EE APIs Web Services Local Portlet Servlet API Portlet API Portlet Container Portlet Context Registries, Directories, Security and Content Management Infrastructure
15
Specification Areas JSR 168 will provide lifecycle and semantics for
Portlets Deployment Descriptor Developer APIs Vendor Extension APIs for security, user customization and layout management
16
States defined JSR 168 defines a minimum set of possible states for a portlet Normal Minimized Maximized
17
Design Goals JSR 168 will try to achieve following design goals
Client agnostic Support for multiple types of clients (multi- device) Simple Portlet API Support for Localization and Internationalization
18
Design Goals (Contd.) Hot deployment and re-deployment of Portal applications Declarative security (similar to that of Servlet and EJBTM) Architected to support remote execution of Portlets
19
Support for Portlet Context
JSR 168 would provide APIs so that Portlets can perform contextual tasks Accessing user profile information for the current user Participation in portal window and action event model Accessing web client information Sharing information with other Portlets Storing/retrieving per-user/per-instance Portlet data persistently
20
URL Rewriting Support JSR 168 will support URL Rewriting mechanism so that Links within a Portlet would be able to trigger actions without requiring knowledge of how URLs are structured in a particular web application
21
Portlet Deployment Portlets would be grouped in a Portal application
by bundling them in a single WAR with a Portlet deployment descriptor Portlet API will provide means for sharing data among portlets of the same Portal application
22
Support for Remote Portlets
JSR 168 would allow support for remote Portlet execution Will not address transport protocol for remote execution of Portlets leaving specifics to Portal implementations For e.g. A static Portlet proxy could be used to invoke a remote Portlet OR can rely on WSRP mechanisms for invoking remote Portlets
23
Goals for consideration
JSR 167 Expert Group will decide whether to support specialized Portlet implementations for Syndication (based on RSS) Web Services access Credential mapping service (somewhat akin to SSO)
24
Schedule and other information
Release of 1.0 specification expected in in December, 2002 Proposed package namespace javax.servlet.portlet An extension to J2EETM 1.4 platform
25
Agenda Introduction to Portals and Portlets Portlet Standards
JSR 168 Portlet Specification WSRP Web Services for Remote Portals Sample implemenation of a HelloWorld Portlet Resources
26
WSRP Aimed towards defining a protocol for
Enabling interactive, user-facing web services to be easily plugged into standards compliant portals Making internet a marketplace of visual web services, ready to be integrated into portals Effort began in January 2002 WSRP Specification 1.0 and compliance Test Kit in December 2002
27
Portal Architecture and WSRP
Portal Server Clients Local Portlets HTML WML VoiceXML... HTTP Portlet API Generic Portlet Proxies Other Portals WSRP Remote Portlets WSRP Pubish/Find Web Services (SOAP) UDDI Registry
28
WSRP Service Lifecycle
UDDI Registry WSRP Services Register Bind Find Portal Client Request
29
WSRP Plug-n-Play
30
Scope WSRP will define A WSDL interface description for invocation of WSRP services Ways to Publish, Find and Bind WSRP services and their metadata Markup fragment rules for markup emitted by WSRP services Applicable Security mechanisms, Billing mechanisms, etc.
31
Business Scenarios supported
Content/Application Provider providing WSRP Service Portal publishing Portlets as WSRP Services Provision of syndicated Content/Billing/Mobility services via WSRP Multimedia portals Enterprise Application services
32
Scenario Content/Application provider providing WSRP service
Client Portals can aggregate presentation from many WSRP services WSRP Services can be portal context aware User profile from portal Desired locale and markup- type User's device constraints UI WSRP Consumer Portal Mark-up fragment transferred via SOAP WSRP Producer
33
Scenario Portals publishing Portlets as WSRP Service
Multiple clients WSRP Consumer WSRP Producer WSRP Wrapper Server Portal Portlet Portal Portlet Portlet Intermediary Portal Publishing Portal Admin of Publishing portal publishes portlet as WSRP service to a UDDI registry Admin of Intermediary portal finds WSRP service through a UDDI browser and binds to it Clients of Intermediary portal select remote portlets like any local portlet to put on their page
34
Interaction between Portal and WSRP
User WSRP Consumer WSRP Producer Allocate new Instance Adds Portlet Create Portlet Instance I Generate Markup Views Portlet Get Portlet Markup I I S A Action Handling Clicks Portlet Perform Portlet Action A S I I S A Destroy Instance Removes Portlet Destroy Portlet Instance I I
35
WSRP/WSIA Common Interfaces
Share common interfaces for Basic life-cycle operations Basic operations for processing actions and getting markup
36
WSRP Interfaces Define interfaces for Advanced life-cycle operations
Advanced operations for processing actions/getting markup pertaining to User profile information contained in requests Device information contained in requests Locale information contained in requests
37
WSRP Protocol Defines protocol of interaction between portal and services Caching considerations Contract for handling instances and sessions Order in which to invoke operations
38
WSRP Publish / Find / Bind / Metadata
Defines method used to publish/find services to and from UDDI Defines metadata to be provided when publishing service Name, Titles, Descriptions Supported Markups/Locales Caching hints
39
WSRP Markup Fragment Rules/Styles
Define valid markup fragments for XHTML/HTML WML/cHTML/VoiceXML (Second prirority) Define URL Rewriting
40
WSRP and Security, Identity, Single Sign-On (SSO)
Define how security mechanisms can be employed with WSRP Define how identity is to be provided by consumers to producers Define how SSO via a consumer to multiple producers may be achieved
41
Agenda Introduction to Portals and Portlets Portlet Standards
JSR 168 Portlet Specification WSRP Web Services for Remote Portals Sample implemenation of a HelloWorld Portlet Resources
42
HelloWorldPortlet Example Sample Implementation uses JetSpeed
Import org.apache.jetspeed.portal.portlets.AbstractPortlet; ... public class HelloWorldPortlet extends AbstractPortlet { public ConcreteElement getContent (RunData objRunData) { return (new StringElement ("Hello World!!") } } * ConcreteElement is an Apache ECS (Element Construction Set, an object based markup generator) class * RunData -> Turbine Class. Would be used later. Source:
43
HelloWorldPortlet Registration To JetSpeed Portlets Registry
<?xml version="1.0" encoding="UTF-8"?> <registry> <portlet-entry name="HelloWorld" hidden="false" type="instance" application="false"> <meta-info> <title>HelloWorld</title> <description> Portlet How To Example 1 – Hello World </description> </meta-info> <classname>HelloWorldPortlet</classname> <media-type ref="html"/> </portlet-entry> </registry> Source:
44
Customize portal page to add HelloWorldPortlet
Source:
45
Personalizing Hello! public class HelloWorldPortlet extends AbstractPortlet { public ConcreteElement getContent (RunData objRunData) { StringBuffer objStringBuffer = new StringBuffer(); objStringBuffer.append("Hello "); String sName = objRunData.getUser(). getFirstName(); objStringBuffer.append (sName + "!"); return (new StringElement (objStringBuffer.toString()); } } Source:
46
Soft-coding Personalized Hello!
public class NewsPortlet extends AbstractPortlet { public ConcreteElement getContent (RunData objRunData) { objStringBuffer.append(getPortletConfig(). getInitParameter ("greeting")); } } Configure parameters for this Portlet in Jetspeed Configuration file (jetspeed-config.jcfg) <portlet-entry ....> <classname>HelloWorldPortlet</classname> <parameter name="greeting" value = "Hello, " /> </portlet-entry> Source:
47
RunData and User RunData object provides access to
Servlet Request object Other session context information Security, Turbine Actions, Cookies, Servlet Parameters (parsed), Current user (via getUser() as shown), etc. User object is used to access typical user information Name, contact information, password, login information, etc.
48
Resources JSR 168 http://www.jcp.org/jsr/detail/168.jsp
SunTM ONE Portal Server tml WSRP and OASIS WSRP and XML Cover Pages
49
code/articles/links/chats/resources
In pursuit of the best software in the universe All presentations Audiocasts Codecamp materials Technology briefings code/articles/links/chats/resources
50
Rima Patel Sriganesh
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.