Portlet Life Circle

Portlet life circle diagram
y1pnein_qeE00qnmBhQC2EOQp-OKRGgwzqw1-8SjuFh9ETEpaw6oYJJ08Le9d1O-Wxv
init(PortletConfig config)
 
This method is called by the portlet container on the abstract portlet when the portlet is first loaded. As with servlets, portlets are loaded when they are first requested. Any subsequent calls to the portlet will not execute this method. Generally, initialization that is applicable to every concrete portlet based on this abstract portlet is placed in this method. If you choose to override this method, at a minimum it should make a call to its parent via super.init(portletConfig). At this point in the portlet life cycle, no portlet-specific storage objects are available. This includes PortletSession, PortletData, PortletApplicationSettings and PortletSettings.
initConcrete(PortletSettings settings)
 
This method is called by the portlet container on the concrete portlet. The initialization code performed in this method is not shared by other concrete portlets even though they may be based upon the same abstract portlet. It is in this method that the PortletSettings object is first available. The PortletSettings encapsulates the concrete portlet configuration parameter information. From the PortletSettings object, the PortletApplicationSettings object is available. The PortletApplicationSettings object encapsulates concrete portlet application context parameters. In this method, no user-specific objects are yet available.
 
login(PortletRequest request)
 
If the concrete portlet has been placed on a page that requires authorization, the login method is called by the portlet container to associate a user with the portlet. It is at this point that the PortletData object is first available. The PortletSession is created by the container for the registered user at this point and is available in this method via the request object. If the request for the portlet is made by an anonymous user, this method is not called. If this method is not called, a default session object can still be created with no user association, though it may be of little practical use. This method is actually defined in the PortletSessionListener interface which is implemented by the abstract class Portlet. Since your custom portlets will extend from Portlet, it is included in this discussion even though other oft-used listeners are not..
 
service(PortletRequest request, PortletResponse response)
 
This method is called on each and every request of the portlet. After the portlet has been added to a page and initially accessed by a user, this is the only method that will be called by the portlet container on subsequent requests. Generally, this method will delegate the request to the appropriate do method to render content. At this point, all portlets and, if applicable, user-specific objects are available.
 
logout(PortletSession session)
 
Only when a user specifically selects the Log Off button on the portal is this method called. This method provides you with the opportunity to manage any user-specific information once the user has logged out and to clean up user-related resources. If the user removes the portlet from their page, the logout method is not called until the user actually logs out of the portal, even though they no longer are accessing the portlet. When the portlet is taken out of service by the Portal server or the administrator, this method will not be called. The PortletSettings object is still available in this method, although the PortletRequest is not. This method is actually defined in the PortletSessionListener interface which is implemented by the abstract class Portlet. Since your custom portlets 82 IBM WebSphere Portal Toolkit V5 will extend from Portlet, it is included in this discussion even though other oft-used listeners are not.e.
 
destroyConcrete(PortletSettings settings)
 
This method is called when the concrete portlet is taken out of service either because of the portal server stopping or the application being uninstalled from the portal server. The portlet container will call each running concrete portlet in the application individually when the application is deleted. In this method, the PortletSettings object is passed in as a parameter and cannot be retrieved from the normal getPortletSettings method.DIV>
 
destroy(PortletConfig config)
 
The portlet container executes this method on the abstract portlet when the portlet is taken out of service. Since it is executed on the abstract portlet and not the concrete portlets, it is executed only once. This method provides an opportunity to execute clean-up code on each and every concrete portlet in the application derived from this abstract portlet.
 

7DBDF42EE58F4A79!217:thumbnail

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值