• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

Developing Portlets For Web Sphere Portal Server

on

  • 6,582 views

css 2002 presentation

css 2002 presentation

Statistics

Views

Total Views
6,582
Views on SlideShare
5,774
Embed Views
808

Actions

Likes
2
Downloads
383
Comments
0

10 Embeds 808

http://itmprof.wordpress.com 682
http://portal-ibm.blogspot.com 69
http://ibmmiddleware.googlepages.com 23
http://portal-ibm.blogspot.com.br 16
http://www.slideshare.net 7
url_unknown 6
http://www.portal-ibm.blogspot.com 2
http://209.85.153.100 1
file:// 1
http://209.85.153.132 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Developing  Portlets For  Web Sphere  Portal  Server Developing Portlets For Web Sphere Portal Server Presentation Transcript

    • Developing Portlets for WebSphere Portal Server dIon Gillard, Multitask Consulting Pty Ltd
    • Agenda What is a portlet?  The Portlet API  Packaging Portlets  Distributed Portals with Web Services  WPS 4.1 and JSR 168? 
    • What is a portlet?
    • What is a portlet?  Many things to many people  To a User A small section of a portal page Provides access to services and information Customisable user interface  To a programmer Pluggable mini-app running in a portlet container Special type of servlet Something new to learn
    • What is a portlet? cont…  Programmer (cont…) An easier way to build complex applications  To the administrator Customizable application hosted by the server Can be aggregated and deployed as a unit Something that can be secured  We’ll be focussing more on the programmer angle
    • Programmers View  Portlet extends HttpServlet  ‘Special’ servlet with some restrictions and some more services available  Can’t access ‘page’ functionality that a servlet can: Redirects Forwards Write any HTML (e.g. <html> doesn’t make sense for a portlet)
    • Programmers View cont…  Are deployed in web.xml like servlets  Other portlet specific configuration is configured in portlet.xml  Have modes View – normal display Edit – user customization of portlet behaviour Help – more information on the portlet Configure – administrator configuration for a single user or group
    • Programmers View cont…  UI States (think frame window) Normal – as configured by the user or admin Maximised – takes the whole page Minimised – only shows title bar  Log available to store system information  User details - name, id etc available  Client details – mark-up expected, user agent details etc
    • The Portlet API
    • Portlet API - Portlet Base class for all portlets  Similar to ‘Servlet’  Not Usually extended  Defines the portlet lifecycle  Portlets can also have listeners  Session, Page, Title, Action, Window, Message, Portal Settings Attribute, Portal Application Settings Attribute
    • Portlet API – Portlet cont…  Life cycle init – called after construction, for initialization initConcrete – initialize the combo of portlet instance and settings service – provide the content of the portlet destroyConcrete – cleanup the combo of portlet instance and unique settings destroy – cleanup the portlet instance
    • Portlet API - PortletAdapter  Default implementation of Portlet  Allows attributes to be manipulated in the concrete portlet  Provides helper methods for standard modes doView doEdit doHelp doConfigure  Similar to HttpServlet.doGet, doPost etc
    • Portlet API - PortletRequest  Passed to helper methods and listeners  Attributes and Parameters ala HttpServletRequest  PortletSettings access to concrete portlet configuration  PortletApplicationSettings access to portlet application configuration  Mode for this request View, Edit, Help, Configure
    • Portlet API – PortletRequest cont…  Client User agent and mark up details  Data Attributes for the concrete portlet Persistent between requests Can be read anytime, write in Edit mode only  Window The ui encapsulating the portlet on a page Typically a <td></td>
    • Portlet API – PortletRequest cont…  Window Holds ui state: normal, minimized, maximized  PortletSession Transient data Similar to HttpSession, except per Portlet  User Details about the user making the request Name, id etc
    • Portlet API – PortletResponse  Similar to HttpServletResponse  getWriter for printing to the response  Also has a way of access the current portlet easily: createURI – URI for current mode createReturnURI – URI for caller of the current portlet URI can have ‘actions’ (e.g. save) added to them for processing pre service
    • Portlet API – PortletContext  Like ServletContext  getPortletConfig().getContext()  Access to context parameters defined in web.xml  Attributes can be get/set  getText() for accessing Resource Bundles  Include – similar to request dispatcher, includes the resource (e.g. jsp)  getResourceAsStream – read other resources
    • Portlet API – PortletContext cont…  send() – sends messages to other portlets  getService() – get access to a configurable service shared across portlets  getLog() – access to a log for system information dumps
    • Listeners  Similar to those included in Servlet 2.3  Implemented by the portlet  Allow the portlet to be more aware of it’s environment  Allow collaboration with other portlets in the container
    • Listeners - PortletSessionListener  Login called after the user logs in to the portal (container) Used to initialize session objects for later use  Logout Called just before the user logs out of the portal Clean up session objects from Login or processing
    • Listeners - PortletPageListener  beginPage called before the page has started processing No service methods called before this Used to write JavaScript, cookies, headers etc  endPage Called after all service methods have been completed Use to write JavaScript etc after all portlets are completed
    • Listeners - PortletTitleListener  doTitle More like view, edit, help etc Allows customization of title in various states or modes Default is the <title> in the deployment descriptor
    • Listeners - ActionListener  actionPerformed(ActionEvent) method  Needed if portlets want to respond to action events  Action events are sent to the portlet when a request is received associated with an action (typically a link or button)  Actions are added to Portlet URIs and then rendered  DefaultPortletAction is provided that has only name
    • Listeners - WindowListener  Implement to hook portlet UI state changes Maximize Minimize restore  A WindowAdapter is provided with an empty implementation for all methods
    • Listeners - MessageListener  Must implement to receive messages from other portlets  Messages can be sent to portlets on the same page, and in the same portlet application  DefaultPortletMessage’s can be sent across application boundaries, but only within a page  Allow portlets to signify changes to others
    • Listeners – MessageListener cont…  MessageEvents are sent  PortletMessage objects are held by the events  Can subclass PortletMessage, but only for intra-app messages
    • Client  Details on the client sending the request  Holds user-agent to identify browser  Mark-up string for the output expected E.g. html, wml, chtml etc  Mime types supported E.g. text/html, text/vnd.wap.wml  Capabilities Level of HTML, JavaScript etc supported
    • Writing Portlets - Taglib  <%@ taglib uri=quot;/WEB-INF/tld/portlet.tldquot; prefix=quot;portletAPIquot; %>  Used in portlet JSPs included into the response  If, log, text, dataLoop, dataAttribute, settingsLoop, settingsAttribute, CreateReturnURI, createURI, encodeNamespace, init
    • Writing Portlets - Taglib If – test mode, state, markup, mime type, capabilities  Log – log output with error level  Text – Write text from a resource bundle  dataLoop, dataAttribute – loop through PortletData attributes  matching a pattern settingsLoop, settingsAttribute – same for PortletSettings  CreateReturnURI – URI for the caller of the portlet  createURI - URI for current portlet with parameters and  action encodeNamespace – create  Init – make portletRequest, portletResponse and  portletConfig available in page scope
    • Writing Portlets - Java // imports removed for sizing public class HelloWorldJSPPortlet extends PortletAdapter { private static final String VIEW_JSP = quot;jsp.viewquot;; public void doView (PortletRequest request, PortletResponse response) throws PortletException, IOException { if (getPortletLog().isDebugEnabled()) getPortletLog().debug(“HelloWordJSPPortlet doView()quot;); String jspName = getPortletConfig().getInitParameter(VIEW_JSP); getPortletConfig().getContext().include(quot;/WEB-INF/jsp/quot;+jspName, request, response); } }
    • Writing Portlets - JSP glib uri=quot;/WEB-INF/tld/portlet.tldquot; prefix=quot;portletAPIquot; %> PI:log text=“HelloWorldView.jsp startedquot; quot;DEBUGquot;/> class=quot;Portletquot; width=quot;100%quot; border=quot;0quot; cellspaci llpadding=quot;0quot;> r> <td>Hello World</td> r> e>
    • Packaging Portlets  Portlets are packaged into portlet applications  Similar to how servlets and JSPs are packaged into web applications  Structure is the familiar WAR file with an extra file /WEB-INF/portlet.xml
    • Packaging – Deployment Descriptors  web.xml Servlet entry for each portlet in the application Parameters can be defined as usual  portlet.xml Root tag is portlet-app-def, holds one portlet- app and one or more concrete-portlet-app • portlet-app  portlet-app-name  One or more portlets
    • Sample portlet.xml <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <!DOCTYPE portlet-app-def PUBLIC quot;-//IBM//DTD Portlet Application 1.1//ENquot; quot;portlet_1.1.dtdquot;> <portlet-app-def> <portlet-app uid=quot;com.myCompany.myPortletApp.54321quot;> <portlet-app-name>My portlet application</portlet-app-name> <portlet id=quot;Portlet_1quot; href=quot;WEB-INF/web.xml#Servlet_1quot;> <portlet-name>My portlet</portlet-name> <supports> <markup name=quot;htmlquot;> <view output=quot;fragmentquot;/> </markup> </supports> </portlet> </portlet-app>
    • Sample portlet.xml – cont… <concrete-portlet-app uid=quot;com.myCompany.myPortletApp.54321.2quot;> <portlet-app-name>My concrete portlet application</portlet-app-name> <concrete-portlet href=quot;#Portlet_1quot;> <portlet-name>My concrete portlet</portlet-name> <default-locale>en</default-locale> <language locale=quot;en_USquot;> <title>My portlet</title> </language> </concrete-portlet> </concrete-portlet-app> </portlet-app-def>
    • Packaging portlet.xml cont…  Portlet tag id must be unique within application href is a link to the servlet defined in web.xml, e.g. WEB-INF/web.xml#servlet_id name – identifies the portlet for messages Optional cache – whether output is cached, when it expires, and whether it is per use allows tag • States supported by the portlet, e.g. <maximized/>
    • Packaging portlet.xml cont…  Portlet tag • Supports tag – mark-ups supported by the portlet and modes allowed for that mark-up, e.g. <supports> <mark-up name=“html”> <view/><edit/><help/><configure/> </mark-up> <mark-up name=“wml”> <view/><help/> </mark-up> </supports>
    • Packaging portlet.xml cont…  concrete-portlet-app Need at least one – this is a configuration of the defined application portlet-app-name –application name context-param • param-name and param-value pairs concrete-portlet – id must be unique, href is a link to the web.xml • portlet-name, default-locale, language (one for each supported)  Language specifies title, short title, description and keywords
    • Packaging portlet.xml cont…  concrete-portlet cont… config-param • param-name and param-value to set up portlet instance
    • Distributed Portals with Web Services  Under standardisation by OASIS (WSRP)  IBM leading workgroup and will provide RI  Portlets can be published to a UDDI directory  Portal administration allows adding of remote portlets discovered in directory  Remote Portal container provides SOAP interface to the remote portlet
    • WPS 4.1 and JSR 168  WPS 4.1 was the starting point for the JSR API discussions  At time of writing, no draft has been released for review  ‘Rumours’ have circulated hinting that the JSR API is very close to WPS 4.1 in structure
    • Summary  Portlets solve many common web app problems  Provide a rich API and UI  Provide a familiar programming model for J2EE Developers  Solve some of the simple component issues not addressed by JavaServerFaces, e.g. page lifecycle hooks  Watch for JSR168