现在的位置: 首页 > 综合 > 正文

[Portal参考手册]生命周期

2013年10月11日 ⁄ 综合 ⁄ 共 1737字 ⁄ 字号 评论关闭

Portlet的生命周期扩展了Servlet的生命周期,增加了更多的控制。就像Servletinitdestroy的方法一样,Portlet使用这些方法初始化和关闭conrete PortletApplication Portlet

Init():Portlet被构造成为一个Portlet实例,在容器内被所有用户共享使用,如Servlet的共享使用一样。这个方法传递PortletConfig实例作为参数。

 

initConcrete() Portlet构造完成后,Portlet被第一次调用之前,初始化PortletSettings

 

service() :当用户请求Portlet时,容器调用此方法为用户提供服务。

 

destroyConcrete() :此方法用来结束concrete Portlet服务,这种情况可能在Portal Server运行中管理员删除一个具体Portlet时发生。

 

destroy() :当Portal Server终止运行后,调用此方法表示Portlet的生命周期结束。

 

Portlet Action 方法:

Action处理所有的由Portlet触发的事件。任何form或者超连接事件都会导致actionPerformed方法执行。其他的事件,如窗口的最大最小化,或者其他portlet传递消息时,也会触发相应的事件。ActionEvent,WindowEventMessageEvent将传递给相应的action

     actionPerformed方法当portlet接受到一个action时被调用。这个方法在任何doViewdoEdit方法执行之前被执行。

     void actionPerformed(ActionEvent event)

    

     messageReceived方法当portlet接受到一条消息时被调用。

     void messageReceived(MessageEvent event)

 

     windowMaximized方法当portlet窗口最大化的时候被调用。

     void windowMaximized(WindowEvent event)

    

     windowMinimized方法当portlet窗口最小化的时候被调用。

     void windowMinimized(WindowEvent event)

    

     windowResized方法当portlet窗口resized的时候被调用。

     void windowResized(WindowEvent event)

 

Portlet Render方法

Portlet容器将显示页面上所有的portlet,基于他们定义的模式。Portlet开发者可以继承这些方法,提供PortletResponse输出流或者使用PortletContext执行include方法包含html文件或者jsp文件。在显示portlet的时候,doTitle被布局引擎所调用。

     doView方法在VIEW模式时被调用

     void doView(PortletRequest request,PortletResponse response)

 

     doEdit方法在EDIT模式时被调用

     void doEdit(PortletRequest request,PortletResponse response)

 

     doConfigure方法在CONFIGURE模式时被调用

     void doConfigure(PortletRequest request,PortletResponse response)

 

              doHelp方法在HELP模式时被调用

     void doHelp(PortletRequest request,PortletResponse response)

    

     doTitle方法在布局引擎显示portlet的时候被调用,开发者可以覆盖这个方法以提供定制的Title

              void doTitle(PortletRequest request,PortletResponse response)

抱歉!评论已关闭.