Top Banner
JSR-286: Portlet 2.0 & JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24 th 2009
48

JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Aug 22, 2018

Download

Documents

vodat
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

JSR-286: Portlet 2.0&

JBoss Portal

Prabhat JhaSenior Engineer

JBoss, a division of Red HatTuesday, Feb 24th 2009

Page 2: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

AgendaAgenda

•Concepts

•Portlet 1.0 (JSR-168) specification

•What’s new in Portlet 2.0 (JSR-286)

•JBoss Portal & Enterprise Portal Platform (EPP)

•Q&A

Page 3: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

ConceptsConcepts

Page 4: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Portal JargonsPortal Jargons

•Portal

•Page

•Portlet‣ Mode‣ State

•Portlet Container

Page 5: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

PortalPortal

•Unify access to your web applications

•Integrate your enterprise-level services

•Provide a consistent UI to your enterprise services

Page 6: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Integration at workIntegration at work

Page 7: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Different users: different views

CSR Portal

Manager PortalCustomer Portal

JBoss Portal Header/Navigation

Product Data

Customer Records

Inventory

ManufacturingInfo

Employee Data

Supply

JBoss Portal Header/Navigation

Product Data

Customer Records

Inventory

Supply

Customer Records

Product Data

Inventory

JBoss Portal Header/Navigation

Page 8: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

To use or not to use Portal?To use or not to use Portal?

•Simple application like a web-blog - NO

•Intranet, Insurance Portal, Banking & Finance Portal- Yes

•Have aggregation and integration of content from different sources?

•Need more than simple personalization?

Page 9: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

PortletPortlet

•User interface component targeted at the portal ecosystem

•Similar to web applications‣ Deployed in a portlet container‣ Can better focus on single task‣ Can delegate common concerns‣ Reusable

Page 10: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Portlet vs ServletPortlet vs Servlet

•Generate markup fragments vs whole document

•URL constructed via portlet api

•Have means of storing persistent config and customization data

•Session data have two scopes

•Can and send receive events

Page 11: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Portlet containerPortlet container

•Similar to servlet containers but for portlets‣ Runs on top of a servlet container

•Manages portlets on behalf of portals:‣ Exposes portlet metadata to portals‣ Manages portlet lifecycle and state‣ Handles portlet invocations

Page 12: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

PortalPortal

Architecture

Portlet ContainerPortlet Container

PortletPortlet PortletPortlet

PortletPortlet PortletPortlet

Page 13: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

JSR-168: Portlet 1.0JSR-168: Portlet 1.0

Page 14: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

JSR-168 specificationJSR-168 specification

•Portlet ecosystem fragmented prior to JSR-168

•Finalized in October 2003

•Integrated with Java EE but not part of it

•Resulted in wide adoption by portal vendors

Page 15: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

JSR-168 overviewJSR-168 overview

•Portlet metadata‣ Description, name, display names‣ Supported content types‣ Keywords‣ Localization

•Web application based packaging‣ Specific descriptor: /WEB-INF/portlet.xml

‣ Portlets implement javax.portlet.Portlet

Page 16: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

JSR-168 at workJSR-168 at work

•Two-step request handling‣ action phase to interact with the portlet‣ render phase outputs markup

•Scoped states‣ render parameters for navigation‣ session with portlet and application

scopes‣ preferences that can be set at several

levels

Page 17: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

JSR-168 limitationsJSR-168 limitations

•Interportlet communication‣ attributes sharing at the application via

session‣ vendor-specific API

•No resource serving‣ Needed additional servlet

•Limited AJAX support

•Bridging web frameworks difficult

Page 18: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

JSR-286: Portlet 2.0JSR-286: Portlet 2.0

Page 19: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

JSR-286 specificationJSR-286 specification

•Released in June 2008

•http://jcp.org/en/jsr/detail?id=286

•Main goals:‣ Backward compatibility‣ Improve portlet coordination‣ Provide support for resource serving‣ Better AJAX support‣ Easier bridging of web frameworks

Page 20: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

JSR-286 new featuresJSR-286 new features

•Public Render Parameters (PRP) - portlets can share parameters

•Events - portlets can now send and receive events

•Resource serving

•Portlet filters - similar to servlet filters

•Java 5: Generics, enum, Annotation

Page 21: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Coordination: PRPsCoordination: PRPs

•Use cases‣ Simple coordination across web

application boundary- Weather, Map, Events based on a zipcode

‣ Sharing of view state across portlets

•Anti-patterns‣ Not meant to synchronize state‣ Cannot be used for complex

coordination

Page 22: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

PRP declarationPRP declaration•In /WEB-INF/portlet.xml

Page 23: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

PRP-using portletPRP-using portlet

Page 24: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

PRP Wiring in JBossPRP Wiring in JBoss

•You can create ALIAS for semantically equivalent PRP‣ Weather Portlet uses ZIP‣ Map Portlet user ZIP_CODE‣ Create my_zip which maps to ZIP and

ZIP_CODE

•Implicit•Explicit

Page 25: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Coordination: EventsCoordination: Events

•Use cases‣ Decoupling of different applications

that need to communicate‣ Integration of legacy event-using

applications‣ Communication between the portal and

the portlet- Login/Logout- Activities

Page 26: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Coordination: EventsCoordination: Events

•Anti-patterns‣ Not suited for business events as

reliable delivery is not enforced (best effort)

‣ Synchronization of render parameters is better done via PRPs

‣ Beware of infinite event processing loops

‣ Not a messaging system

Page 27: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Coordination: Events Coordination: Events

Ref: http://www.ibm.com/developerworks/websphere/library/techarticles/0803_hepper/image002.gif

Page 28: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Coordination: Events Coordination: Events •New event phase

‣ Optional‣ Occurs after action (which can

generate events) and before render‣ Portlets implementing EventPortlet can

react via processEvent method

Page 29: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Event declarationEvent declaration•In /WEB-INF/portlet.xml

Page 30: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Event-publishing Event-publishing portletportlet

Page 31: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Event-processing Event-processing portletportlet

Page 32: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Events Wiring in JBoss Events Wiring in JBoss PortalPortal

•Implicit

•Explicit

Page 33: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Resource ServingResource Serving

•Logical extension of render phase

•Complete control over HTTP response

•Has access to portlet context, portal security

•Must implement serveResource method on ResourceServingPortlet interface

•Can be leveraged for AJAX‣ Deliver markup fragment as resources‣ Use session to update navigational state

Page 34: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Resource ServingResource Serving

•Different Cacheability‣ Fully cacheable resource

- Does not depend on interaction state‣ Full and shared cacheable resource

- JS library‣ Portlet level cacheability

- pdf view of current portlet‣ Page level cacheablility (default)

- Ajax resources

Page 35: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Resource ServingResource Serving

public void serveResource(ResourceRequest resRequest, ResourceResponse resResp) throws PortletException, IOException {  

  resResp.setContentType("image/png");

  byte[] b = getImage("MyImage.PNG");  //Returns image bytes

   resResp.getPortletOutputStream().write(b);

}

Page 36: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Resource serving: Resource serving: AJAX exampleAJAX example

JSR-168

JSR-286

Ref: http://www.ibm.com/developerworks/websphere/library/techarticles/0803_hepper/image005.gif

Page 37: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Portlet filtersPortlet filters•Similar to servlet filters

•Can modify request and response

•Can receive initialization parameters

•Applied to the different lifecycle methods:lifecyclelifecycle parameter parameter methodmethod

ACTION_PHASEACTION_PHASE processActionprocessActionEVENT_PHASEEVENT_PHASE processEventprocessEvent

RENDER_PHASERENDER_PHASE renderrenderRESOURCE_PHASERESOURCE_PHASE serveResourceserveResource

Page 38: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Filter declarationFilter declaration•In /WEB-INF/portlet.xml

Page 39: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Other featuresOther features

•Request and response header access‣ Easier injection of <head> elements in

aggregated markup: doHeaders(..)‣ Read/write HTTP headers‣ Cookie access

•Improved caching

•Improved request dispatching for better bridging support

Page 40: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Compatibility with 1.0Compatibility with 1.0•Generally backward compatible

•But some things to be aware of:‣ Portlet URLs are now XML escaped by

default. Can be changed by overriding runtime option

‣ Specifying multiple values for a parameter now must create a value array

‣ getProtocol now returns ‘HTTP/1.1’ instead of null

‣ RenderResponse.setContentType no longer required to be called before retrieving output stream or writer

Page 41: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

JSR-286 new featuresJSR-286 new features

•Class Digram

Page 42: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Summary Of JSR-286Summary Of JSR-286

•JSR-286 is a welcome evolution of the Portlet specification

•Much better coordination options for improved portlet reusability & business like mashup

•Overall improvements make developing portlets easier

• What does it lack??

Page 43: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

JBoss Enterprise Portal PlatformJBoss Enterprise Portal Platform

•Standards based

•Easily Extendible

•Performance and Scalability

•Centralized Security (SSO, Identity Manager)

•Modular‣ Lightweight bare portal‣ Deploy/undeploy on demand

Page 44: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

JBoss Enterprise Portal PlatformJBoss Enterprise Portal Platform

•JBoss SX: JAAS-based security

•JBoss Cache: performant, fault-tolerant caching

•Hibernate: database independence, persistence

•JBPM: business processes

•JBoss WS: WSRP

•JBoss Portlet Bridge: JSF, MyFaces, RichFaces, Seam

Page 45: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

JBoss Enterprise Portal PlatformJBoss Enterprise Portal Platform

1 2 3 4 5 10

Max TPSMax Number of Concurrent Users

Number of Nodes in Cluster

Page 46: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

How are we staying busy?How are we staying busy?

•AS 5 Compatibility

•Identity framework

•Authorization framework

•Tooling with JBDS

•Seam and Richfaces Integration

•Presentation Framework

Page 47: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Getting InvolvedGetting Involved

•Contribute Code (Feature, Bug fixes..)

•i18n

•User forum

•Integrating with various frameworks & their HowTo guide

•Documentation

Page 48: JSR-286: Portlet 2.0 JBoss Portal - Austin Java Users … · JBoss Portal Prabhat Jha Senior Engineer JBoss, a division of Red Hat Tuesday, Feb 24th 2009. Agenda ... •Seam and Richfaces

Q & AQ & A