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

Portlet

on

  • 4,518 views

 

Statistics

Views

Total Views
4,518
Views on SlideShare
4,507
Embed Views
11

Actions

Likes
3
Downloads
334
Comments
3

2 Embeds 11

http://www.slideshare.net 10
http://webcache.googleusercontent.com 1

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

13 of 3 previous next Post a comment

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • www.alljobsu.blogspot.com
    www.liferay4you.blogspot.com
    Are you sure you want to
    Your message goes here
    Processing…
  • jobs for uLiferay for u
    Are you sure you want to
    Your message goes here
    Processing…
  • www.alljobsu.blogspot.com
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Administration tasks are broken down into categories (Portlets, Portal Settings, etc.), groups of related tasks (Manage Users, Manage User Groups), and single tasks (Search for users, Create new user).

Portlet Portlet Presentation Transcript

  • Portlet Tutorial Kalpesh Sharma
  • What is a Portal?
    • According to the Portlet Specification, “A portal is a web application that commonly provides personalization, single sign on, content aggregation from different sources, and hosts the presentation layer of information systems. Aggregation is the act of integrating content from different sources within a web page."
  • Portal Page
  • What is a Portlet?
    • "Portlets are web components--like Servlets--specifically designed to be aggregated in the context of a composite page. Usually, many portlets are invoked to in the single request of a portal page. Each portlet produces a fragment of markup that is combined with the markup of other portlets, all within the portal page markup." (from the Portlet Specification , JSR 168)
  • Portlet Architecture
  • Portlet Container
    • A portlet container runs portlets and provides them with the required runtime environment.
    • A portlet container contains portlets and manages their life cycles.
    • It also provides persistent storage mechanisms for the portlet preferences.
    • A portlet container receives requests from the portal to execute requests on the portlets hosted by it. It also collects response from the Portlets and send it back to the Portal.
  • Portlet Container
    • A portlet container is not responsible for aggregating the content produced by the portlets; the portal itself handles aggregation.
    • A portal and a portlet container can be built together as a single component of an application suite or as two separate components of a portal application.
  • How a Portal Page Is Created ?
  • Elements of a Portal Page
  • Portlet Look and Feel
    • Your portal server decides the overall look and feel of the portal page, such as the logo, the colors of the title bars, the images for the controls, etc.
    • By changing a few standard JSPs and .css files, you can change the complete look and feel of your portal.
  • Portlet Life Cycle
    • The basic portlet life cycle of a JSR 168 portlet is:
    • Init: initializes the portlet and put the portlet into service
    • Handle Requests: process different kinds of action- and render-requests.
    • Destroy: put portlet out of service.
    • The portlet container manages the portlet life cycle and calls the corresponding methods on the portlet interface.
  • Portlet Life Cycle
    • Every portlet must implement the portlet interface, or extend a class that implements the portlet interface ( javax.portlet.Portlet) . The portlet interface consists of the following methods: init(PortletConfig config): to initialize the portlet. This method is called only once after instantiating the portlet. This method can be used to create expensive objects/resources used by the portlet.
  • Portlet Life Cycle
    • processAction(ActionRequest request, ActionResponse response): to notify the portlet that the user has triggered an action on this portlet. Only one action per client request is triggered. In an action, a portlet can issue a redirect, change its portlet mode or window state, modify its persistent state, or set render parameters.
  • Portlet Life Cycle
    • render(RenderRequest request, RenderResponse response): to generate the markup. For each portlet on the current page, the render method is called, and the portlet can produce markup that may depend on the portlet mode or window state, render parameters, request attributes, persistent state, session data, or backend data.
    • destroy(): to indicate to the portlet the life cycle's end. This method allows the portlet to free up resources and update any persistent data that belongs to this portlet.
  • Portlet Vs. Servlet
    • Portlets are similar to servlets, in that:
    • Portlets are web components managed by a specialized container.
    • Portlets generate dynamic content.
    • A portlet's life cycle is managed by the container.
    • Portlets interact with web client via a request/response paradigm.
  • Portlet Vs. Servlet
    • Portlets are different from servlets, in that:
    • Portlets only generate markup fragments, not complete documents.
    • Portlets are not directly URL addressable. You can not send somebody URL of a portlet. You can send him the URL of the page containing a portlet.
    • contd…
  • Portlet Vs. Servlet
    • 3. Portlets cannot generate arbitrary content, since the content generated by a portlet is going to be part of portal page. If a portal server is asking for html/text , then all portlets should generate text/html content. On the other hand, if the portal server is asking for WML, then each portlet should generate WML content.
  • Additional Portlet functionalities
    • Request processing
    • Portlet modes
    • Window state
    • Persistent storage for preferences
  • Additional Portlet functionalities
    • 1. Request processing
    • A portlet may get a request when : - user takes some action on it (a state called action phase ), OR - because the user took action on some other portlet and the page needs to be refreshed (a state called render phase ) A portal server provides different callback methods for handling both situations.
  • Additional Portlet functionalities
  • Additional Portlet functionalities
    • The portlet interface has two different methods to represent two different phases of request processing.
    • processAction(ActionRequest actionRequest, ActionResponse actionResponse) : The portlet container will call this method when some action is performed on a portlet. It will pass information submitted by the user, such as values entered in a form, in an ActionRequest object. You can use the ActionResponse to redirect the user to a new page.
  • Additional Portlet functionalities
    • render(RenderRequest renderRequest, RenderResponse renderResponse) : This method is similar to the service() method in the Servlet API. It is called in the render phase, but you should not override it directly. Instead, you override one of the mode-specific methods, such as doView() , doHelp() , or doEdit() . The render() method will determine the mode requested by the user and call the appropriate do Mode () method. Contd…
  • Additional Portlet functionalities
    • Contd…
    • The portlet container will pass a RenderRequest and RenderResponse to this method. The developer can write markup via the object returned by renderResponse.getWriter() . But RenderRequest does not directly get HTML form values submitted by the user--instead, it has go through PortletSession .
  • Additional Portlet functionalities
    • 2. Portlet modes
    • - A portlet mode indicates the function a portlet performs.
    • - Usually, portlets execute different tasks and create different content depending on the functions they currently perform.
    • - A portlet mode advises the portlet what task it should perform and what content it should generate.
  • Additional Portlet functionalities
    • JSR 168 splits portlet modes into three categories:
    • Required modes: Edit, Help, and View
    • Optional custom modes: Config,Preview,Print, About
    • Portal vendor-specific modes: These modes are not defined in the specification and are therefore vendor specific.
  • Additional Portlet functionalities
    • 3. Window state - A window state indicates the amount of portal page space that will be assigned to the content generated by a portlet. - When invoking a portlet, the portlet container provides the current window state to the portlet. - Portlets can programmatically change their window state when processing an action request.
  • Additional Portlet functionalities
    • JSR 168 defines the following window states
    • Normal: Indicates that a portlet may share the page with other portlets. This is the default window state.
    • Maximized: Indicates that a portlet may be the only portlet on the portal page or that the portlet and can therefore produce richer content than in a normal window state.
    • Minimized: Indicates that the portlet should only render minimal output or no output at all.
  • Additional Portlet functionalities
    • 4. Persistent storage for preferences
    • - The portlet can store persistent data for a specific user by using the PortletPreferences object. - Preferences can be read and written in the action phase, and read in the render phase. - The preferred mode to write preferences is the Edit mode, which provides the user with a customization screen.
  • When do Portlets make the most sense?
    • Portlets can be extended to work on many client devices. Your users can move from computer to computer, and mobile device to mobile device, and still use the information and applications they need.
    • Portlets help divide complex applications into tasks: in general, one group of closely related tasks equals one portlet. WebSphere Portal Server's administration portlets are a good example.
  • When do Portlets make the most sense?
    • Portlets make it easy to add features to your applications later. If the new feature is large, you should create a new portlet. For small updates, you can update the existing portlets without losing users' individual preferences.
    • Portlets allow you to easily customize their content for different user groups, and individual users can rearrange and tailor them to their needs.
  • When do Portlets make the most sense?
    • Portlets can be published as Web services, so that companies outside of your portal server's environment can easily write programs to use them.
    • The portal server works with the Web application server to provide security, installation support, reliability, and availability for many users, so you don't need to spend a large part of your development effort working on these features.
  • When are other solutions better?
    • User interfaces with data that must be constantly updated are not portlet material.
    • Portlets need to live "within their box." Be careful if you have a link in a portlet that takes you to a Web page outside of the portal server environment, because it is difficult to get back to the portal after that.
    • Frames are not allowed (Internal frames are allowed, but only Microsoft Internet Explorer users can see them).
  • Conclusion
    • For any new technology to be successful, it should have few qualities:
    • - first, it should leverage existing technology; - second, it should solve common problems of existing technology;
    • - third, it should provide you one more layer of abstraction.
    • The Portlet API has a very good chance of succeeding servlet technology, because it is capable of using the existing application server infrastructure.
  • Conclusion
    • Portlets provide you with a layer of abstraction because now you no longer have to worry about what HTTP method is used by the client, or create your own infrastructure to capture client events like button clicks.
    • Last but not least, portlets solve most of the common problems of servlets by providing services for things like single-sign-on, personalization, etc.
  • References
    • http://www.onjava.com/pub/a/onjava/2006/02/01/what-is-a-portlet-2.html
    • http://www.onjava.com/pub/a/onjava/2006/02/01/what-is-a-portlet.html
    • http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-portlet_p.html
    • http://www-128.ibm.com/developerworks/ibm/library/i-portletintro/
    • http://www-306.ibm.com/software/genservers/portal/
    • http://www.webspherecentral.com