aspose file tools*
The moose likes Portals and Portlets and the fly likes Handling Portlet requests Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "Handling Portlet requests" Watch "Handling Portlet requests" New topic
Author

Handling Portlet requests

Shemida Nivedha
Greenhorn

Joined: May 22, 2008
Posts: 18
Hi,
I am new to portlets.
On comparing the portlets to servlets I have a doubt.
We know that the servlet container will spawn new threads & creates instances of portlets making it accessible for the requests received.
So how are the portlets handled?
Who takes care of the responsibility to spawn threads & make the portlets instance accessible?
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Portlets are in many ways similar to Servlets. In fact, in the old days, Portlet extended Servlet.

A big mistake of many new Portlet programmers is to use a Portlet as though it was a Servlet. Portlet programming IS different. But much of the semantics is the same. The portal server does run on a servlet engine, and the same type of threading that happens with Servlets happens with Portlets.

Portlets do have a slightly different lifecycle and lifecycle methods, but quite often, the way they are implemented behind the scenes are very, very similar.

-Cameron McKenzie
Jonas X. Yuan
author
Ranch Hand

Joined: May 18, 2008
Posts: 108
Hi,

Abstract from JSR-286 spec.

Relationship with Servlets

A servlet is a Java technology based web component, managed by a container, which generates dynamic content [JSR 154]. Like other Java-based components, servlets are platform independent Java classes that are compiled to platform neutral byte code that can be loaded dynamically into and run by a Java enabled web server. Containers, sometimes called servlet engines, are web server extensions that provide servlet functionality. Servlets interact with web clients via a request/response paradigm implemented by the servlet container.

Portlets share many similarities with servlets:
�Portlets are Java technology based web components
�Portlets are managed by a specialized container
�Portlets generate dynamic content
�Portlets lifecycle is managed by a container
�Portlets interact with web client via a request/response paradigm

Portlets differ in the following aspects from servlets:
�Portlets only generate markup fragments, not complete documents. The Portal aggregates portlet markup fragments into a complete portal page
�Portlets can only be invoked through URLs
�Web clients interact with portlets through a portal system
�Portlets have a more refined request handling, action requests, event request, resource requests and render requests
�Portlets have predefined portlet modes and window states that indicate the function the portlet is performing and the amount of real state in the portal page
�Portlets can exist many times in a portal page


Books: Liferay Portal 6.1 Systems Development
Shemida Nivedha
Greenhorn

Joined: May 22, 2008
Posts: 18
Hi all,
Thanks for the wonderful explanations.
Now I am clear with the differences.

Shemida
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Handling Portlet requests
 
Similar Threads
Unblocking sockets
SingleThreadModel
LogServlet Sends response first and then processes request
Thread Pool Management in SocketServer.
How to close all the port allocated by tomcat after a doGet() request