Mission Possible: Migration to WebSphere

pityingmushroomInternet και Εφαρμογές Web

7 Αυγ 2012 (πριν από 5 χρόνια και 3 μήνες)

381 εμφανίσεις

SFSU WebSphere Portal Server Enablement

SFSU WebSphere Portal Server
Enablement

IBM Portlet API vs. JSR 168

Speaker
: Michael Postaski, Senior Portal Developer


email: postaski@us.ibm.com

SFSU WebSphere Portal Server Enablement

Agenda


Java Community Process


Basic Concepts


Important Similar Concepts


Important Differing Concepts


New JSR 168 Concepts


Missing JSR 168 Concepts

SFSU WebSphere Portal Server Enablement

Introduction & Background


A variety of different APIs for portal components, called portlets, has
been created by different vendors



Creates problems for application providers, portal customers and
portal server vendors



Java™ Portlet Specification JSR 168 standard will provide
interoperability between portlets and portals



IBM Portlet API will still be supported in the next WebSphere
Portal 5 releases and the next major release WebSphere Portal
Version 6

SFSU WebSphere Portal Server Enablement

Java Community Process


The Java Standardization Request 168 (JSR 168) defines a
Portlet Specification


Contract between the portlet container and the portlet


Done in the Java Community Process (JCP)


Via the JCP everyone can work to extend the Java™
Language Specification


JSR 168 was co
-
lead between IBM and Sun

SFSU WebSphere Portal Server Enablement

Basic Concepts


Basic portal architecture concepts are the same between the IBM
Portlet API and the JSR 168


A portal is a web based application that hosts the presentation layer
of Information Systems


A portal page represents a complete markup document and
aggregates several portlet windows


A portlet is a Java technology based web component, managed by a
portlet container, that processes requests and generates dynamic
content


A portlet container runs portlets and provides them with the required
runtime environment


SFSU WebSphere Portal Server Enablement

Similar Concepts
-

Portlet Modes


Portlet mode
-

indicates the function a portlet is performing


IBM API defines these modes




View


Edit


Help


Configure


JSR 168 defines
-


View, Edit, Help as required modes


About, Config, Edit_defaults, Preview, Print as optional custom modes


JSR 168 also allows portal vendor specific modes !

SFSU WebSphere Portal Server Enablement

Similar Concepts
-

Window State


IBM API defines:


Maxmized


Minimized


Normal


Solo


JSR 168 does not provide Sole state


JSR 168 does allow the portal to define additional window
states

SFSU WebSphere Portal Server Enablement

Similar Concepts
-

Portlet life cycle and request
processing


Basic lifecycle common to both APIs:


init


to initialize the portlet and put the portlet into service


handle requests


process different kinds of action and
render requests


destroy


to put portlet out of service


Request Handling broken into two phases:


Action Processing
-

must be finished before any rendering
of the portlets on the page is started


Rendering content
-

produces its markup to be sent back
to the client

SFSU WebSphere Portal Server Enablement

Similar Concepts
-

Portlet life cycle and request
processing

SFSU WebSphere Portal Server Enablement

Similar Concepts
-

Include servlets/JSPs


Both API’s allow you to include content generated by servlets or JSPs in the
portlet output via including servlets or JSPs


The IBM Portlet API include method is called directly on the portlet context


IBM API example:


PortletContextcontext=getPortletConfig().getContext();


context.include(someJSP,request,response);


The JSR 168 the include mechanism is the same as in the servlet API


JSR 168 example:


PortletRequestDispatcher
rd=getPortletContext().getRequestDispatcher(someJSP);


rd.include(portletRequest,portletResponse);

SFSU WebSphere Portal Server Enablement

Similar Concepts
-

Portlet application packaging


All resources, portlets and the deployment descriptors are
packaged together in one web application archive (WAR file)



Portlet applications have an additional deployment
descriptor: portlet.xml



In the IBM Portlet API all portlets must also be listed in
the web.xml, as they are also servlets

SFSU WebSphere Portal Server Enablement

Differing Concepts


Portlet application entity


IBM Portlet DD’s define abstract portlet applications as well
as instances defined as concrete portlet applications


Allows settings of abstract application to be reused along
with unique parts for each concrete application


Initialization parameters stored in web.xml


JSR 168: NO abstract/concrete


JSR 168 defines one portlet application along with portlet
definitions for this application


Initialization parameters stored in portlet.xml


SFSU WebSphere Portal Server Enablement

Differing Concepts


Portlet entity


IBM API


one object instance
per portlet configuration in the web
deployment descriptor


Concrete parameterization of a portlet object (PortletSettings) is
referred to as a concrete portlet


JSR 168


“Entity” concept


Entity can be based on another entity or based on the portlet
definition in the deployment descriptor


Relationship from one entity to another entity not currently defined in
this spec version

SFSU WebSphere Portal Server Enablement

Differing Concepts


Action and Render
Request / Response objects


IBM API


request/response objects same in action/render
phases


Can set object on request in action phase and retrieve in
render phase


NOT POSSIBLE in JSR 168


action request / response objects are different from render
request / response objects


Able to save state
-
type information as render attributes,
rather than session attributes

SFSU WebSphere Portal Server Enablement

Differing Concepts


Portlet API does not extend
servlet API


IBM Portlet API portlets extend servlets


JSR 168 portlets are separate components


Why? Portlets are different from servlets


With JSR 168 it is possible to define a clear programming
interface and behavior for portlets


Many concepts and parts of the portlet API have been
modeled like the servlet API


deployment, classloading, web applications, web application
lifecycle management, session management and request
dispatching

SFSU WebSphere Portal Server Enablement

Differing Concepts


TAG libraries


IBM Portlet API defines a lot of tags that overlap with the new Java
Standard Tag Library (JSTL)


The existence of JSTL taken into account when designing the JSR
168 tag library


Few portlet specific tags:


defineObjects tag


to define the basic portlet API objects
RenderRequest, RenderResponse, and PortletConfig.


actionURL tag


to create an action URL.


renderURL tag


to create a render URL.


namespace tag


to namespace values for a specific


Use JSTL for all other purposes

SFSU WebSphere Portal Server Enablement

New JSR 168 Concepts


Render parameters


stay the same for every render request until a new action occurs


store navigational state in the render parameters instead of the session


Extension Mechanisms


allow vendors to provide additional functionality


Portlets can use extensions when/if available


Custom window states


Custom portlet modes


Custom user info


Define in DD which profile info you would like to access


Request/Response properties


Send vendor specific info to the portlet


Available in action phase






SFSU WebSphere Portal Server Enablement

New JSR 168 Concepts (ctd.)


Web application session scope


Every component of web app. can access this information


i.e. share info between a portlet and servlet


Resource bundles


Localization of resources


portlet title, text, etc.


Multiple response content types


Portal sends portlet list of available content types


Portlet declares support for content types in DD


Redirect in action


Portlets can redirect to other web resources in response to an action (ex
-

Servlets)


Preference validator


Defined in DD, validate preferences are set by admin, check dependencies

SFSU WebSphere Portal Server Enablement

New JSR 168 Concepts (ctd.)


Portal context


Allow portlets to adapt to portal that is calling it


Provides vendor, version, also other properties


Localization support


Localize DD settings


Can also localize portlet resources

SFSU WebSphere Portal Server Enablement

Missing JSR 168 Concepts


Events


no Events in JSR 168


ActionEvent


MessageEvent


PortletApplicationSettingsAttributeEvent,PortletSettingsAttributeEvent


WindowEvent


Lifecycle Events


PortletPageListener


PortletSessionListener


EventPhaseListener


Portlet Menus


Invalidation
-
based caching


IBM Portlets can actively invalidate the cache for the current mode and
markup

SFSU WebSphere Portal Server Enablement


QUESTIONS?


SFSU WebSphere Portal Server Enablement