Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Handling Portlet requests

 
Shemida Nivedha
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Shemida Nivedha
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Thanks for the wonderful explanations.
Now I am clear with the differences.

Shemida
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic