`
pwosboy
  • 浏览: 84188 次
最近访客 更多访客>>
社区版块
存档分类
最新评论

Porlet的类和接口

阅读更多
Portlet->PortletAdapter
PortletRequest(接口)
PortletResponse(接口)
PortletSession(接口)
Client
 
基本上新编写的Portlet都是要继承PortletAdapter。PortletAdapter基本上实现所有的接口和方法。与Portlet不同的是,它几乎复写了所有抽象函数。估计设计这样两个抽象类(Portlet和PortletAdapter)是为了不同层次上的继承来设计的。
 
PortletRequest,PortletResponse,PortletSession没有什么太多的文章,只要在Portlet中正确使用就行了,参考HttpServletRequest,HttpServletResponse。
 
Client的主要作用是用来探测客户端的类型。
 
PortletConfigPortletContext
其中PortletContext比较重要,下面摘录它的描述如下。
The PortletContext provides a mechanism for the portlet to access the services of the portlet container in which it is running. For example, the Context provides access to the PortletLog, servlet context parameters as well as any services hosted by the portal such as Credentials Vault, PersistentConnection and possibly other custom services. The parameters accessed by the PortletContext are the context parameters set in the web.xml. These parameters are common to Chapter 2. Portlet API 89 all portlets deployed in the same web.xml, regardless of their organization into various portlet applications. The PortletContext object is retrieved from the PortletConfig object。
看了描述基本上比较清楚了,唯一比较敢兴趣的是直接去引用呢,还是IBM自己设计了一套更合理的读取方式?
 
PortletSettingsPortletApplicationSettings看了让人觉得眼花,主要作用是读取和设置在portlet.xml中concrete-portlet元素和concrete-portlet-app元素的属性值。
 
PortletData(请注意它是一个不需要实例化,一个可以被用户共享,又可以被单独用来存储用户内容的对象)
It provides a quick, secure and effective method of attribute persistence with no JDBC code required.
 
下面的例子把它解释的比较清楚了。
For example, the HelloWorld portlet uses PortletData to persist the greeting String and the moniker the user wishes to be addressed by. The Administrator installs this portlet, grants edit permissions to the All Authenticated Users group and places it on the Welcome page. The Administrator chooses to edit the portlet and enters “hello there” as the greeting String and “admin” as the moniker. When user JohnSmith logs into the portal page and opens the welcome page, he sees the name admin and the greeting “hello there”. The administrator decides to change the greeting to “Greetings”. Since JohnSmith has not edited the PortletData, he continues to share the PortletData and sees the changes the admin has made. JohnSmith chooses to edit the PortletData to use his name instead of admin. Once he edits the PortletData, he has his own PortletData object. Changes he makes will be seen by no one else. Furthermore, he will no longer see any changes to the PortletData made by the administrator.
 
PortletLog,PortletException,PortletWindow,User,PortletURI,这些对象差不多从名字就可以判断他们的作用。
 

Listeners

这些listners用他们的例子来表示是最清楚的。
PortletTitleListener
public void doTitle(PortletRequest request, PortletResponse response) throws PortletException, IOException
{ PrintWriter out = response.getWriter();
String title = getPortletSettings().getTitle( request.getLocale(), request.getClient());
out.print(title + "(" + request.getMode() + ")");
}
PortletPageListener
public class AgendaPortlet extends PortletAdapter implements
PortletPageListener {
........
public void beginPage(PortletRequest request, PortletResponse response)
throws PortletException, IOException {
PrintWriter out = response.getWriter();
out.println("This page contains my agenda.");
}
public void endPage(PortletRequest request, PortletResponse response)
throws PortletException, IOException {
PrintWriter out = response.getWriter();
out.println("End of my agenda.");
}
}
WindowListener
public void windowMaximized(WindowEvent arg0) throws PortletException {
// Some action can be performed
}
public void windowMinimized(WindowEvent arg0) throws PortletException {
// Some action can be performed
}
public void windowRestored(WindowEvent arg0) throws PortletException {
// Some action can be performed
}
public void windowClosing(WindowEvent arg0) throws PortletException { }
public void windowClosed(WindowEvent arg0) throws PortletException { }
public void windowDetached(WindowEvent arg0) throws PortletException { }
分享到:
评论

相关推荐

    JSR168 PORLET标准手册

    JSR168是Java Portlet API...总结起来,JSR168 PORLET标准是Java世界中门户技术的重要基石,它定义了portlet的接口和行为,促进了Web组件的标准化和重用,为构建高度可定制和交互性强的门户网站提供了坚实的技术支持。

    spring4.1核心包

    Porlet工作流程和Servlet的主要差异在于,Portlet的请求处理有两个独特 的阶段:动作阶段和显示阶段。动作阶段会有“后台”数据改变或动作的代码,这些代码 只会执行一次。显示阶段会产生用户每次刷新时的看到的...

    JSR168+PORLET标准手册

    **JSR168与Portlet标准详解...总结,JSR168是Java世界中关于portlet的重要标准,它定义了一套统一的接口和行为,促进了portlet的跨平台复用。通过理解和应用JSR168,开发者可以构建更加灵活、高效的企业级Web门户应用。

    portal原理,详细讲解

    这些框架提供了开发、部署和运行Porlet的标准接口和机制,简化了开发流程。 7. **portlet通信** Porlet间的通信可以通过事件模型(Eventing)或渲染参数(Render Parameters)来实现。事件模型允许Porlet之间发送...

    portel 文档介绍

    "JSR168 PORLET标准手册汉化整理.doc"则是关于JSR168标准的详细解释,可能涵盖了portlet的基本概念、portlet容器的职责、portlet的API接口,以及portlet如何与其他portlet或系统进行交互等内容。理解这个标准对于...

    Portlet 案例项目

    Portlet是一种Java Web组件,遵循portlet规范(如JSR 286或JSR 168),它定义了portlet与门户服务器之间的接口。Portlet可以处理请求、呈现内容,并与其他portlet进行通信。它们通常通过门户框架(如Liferay)来管理...

    猪排

    "Porlet"可能是项目中特定模块的名称,或者是一个自定义术语,可能指的是某种用户界面组件、服务端接口或者特定功能的集合。Porlet可能采用MVC(模型-视图-控制器)架构模式,使得代码结构清晰,便于维护和扩展。 ...

    Portal培訓教材之第7章_常见SSO原理及其实现_FromIBM(7)

    DSAPI是一种专门用于连接Domino服务器和其他应用(如Sun Portal或Oracle Portal)的接口,通过DSAPI可以实现在这些平台之间的SSO。 3. **TAM (Tivoli Access Manager / Tivoli Identity Manager)** TAM提供了一...

    jboss portlet实现文件上传小项目

    - **文件处理**:使用Servlet API的Part接口或者第三方库如Apache Commons FileUpload来解析上传的文件。 - **存储文件**:将接收到的文件保存到服务器的指定位置,可能需要考虑文件命名冲突、大小限制等问题。 -...

Global site tag (gtag.js) - Google Analytics