The first part of the Liferay Portal Framework Analysis
This part of the main content
Portal Server Portal Portlet Container
Portal as an open source product, Liferay Portal provides the contents of multiple independent systems integration, to help various organizations to achieve more effective cooperation. Portal products to other businesses than, Liferay Portal has a number of good features, but do not pay.
Section Portal Specification
With the rise of Portal, a growing number of companies are involved in product development, Portal and the Portal components and set up their own based on its products, such as IBM, BEA, MicroSoft, SAP, Apache, etc.. Various manufacturers are not compatible interface to software developers and developers inconvenience.
To this end, JCP group released JSR168 (Java Specification Request), Portlet Specification V1.0, used to provide different between Portal and Portlet interoperability. As long as follow the development of Portlet JSR168, you can all follow to deploy JSR168's Portal to run.
Portal JSR168 implementation defined specifications and interfaces, and the ideal Portlet carried out a detailed plan and description.
WSRP is the OASIS Web Service for Remote Portlet initials. WSRP is a Web Service of a new business application, a new standard, mainly used to simplify the Portal for the integration of resources or the complexity of procedures, to avoid programming brought about the integration problems and issues. And Portal administrators can select the mass of WSRP services need to integrate the functions of the Portal in the currently used. It has three roles:
①, producers provide Portlet à
②, consumers use the Portlet à
③, the end-user end-user à
It features the producer is the consumer needs information through WSRP returned to the consumer, the information is relatively tag fragments, such as HTML, XHTML, etc., can be embedded directly the user's page, without resorting to develop a client Web Service Yiyang interfaces.
Achieve this standard, Portal can deal with a variety of data sources, a complete end to the dilemma of information island.
II What is the Portal
Portal is a Web-based order "application integration" and "to eliminate islands of information" as the ultimate goal, to provide single sign-on, content aggregation, personalization features such as portal customized integrated information system.
Usually complete by the Portal Server Portal, Portlet Container, Portlet form.
1.2.1 Portal Server
Portal Server is up Portlet container Portlet rendering support to the general or special Web server. Portal servers typically provide personalization, single sign-on, content aggregation, information dissemination, rights management and other functions, supports a variety of information sources of data and data on the pages of these combinations, to provide personalized content tailored different permissions visitors can browse the contents of different information. Usually, Portal provides the following features:
Single Sign: Portal usually Caiyong ACL, SSL, LDAP and other industry-standard security technology, provides access to all existing application security Ji Cheng, only the single entry in the Portal Shangdeng Lu once and can access all applications and data . For higher security requirements of applications such as e-commerce platforms, trading systems, by extending the interface to pass user identity information, such as digital certificate, digital signature information, the secondary authentication, to ensure the safety of single-point landing .
Access Control: System, LDAP right resources, a unified user management interface to provide secondary development, with other application systems user management module docking, and can Sui Xiang Guan business Xitongshishi update the access permissions. Through the improvement of the licensing mechanism and access control, user access control to field level to ensure that users can only access the applications with permissions and related information.
Content Management: Implementing real-time exchange of information between applications. Using a variety of caching mechanisms to guarantee the performance and accuracy of the content of the exchange. XML-based Rich Site Summary (RSS) standards, and rapidly spread among the various applications the latest changes.
News: Implementing a dynamic information portal content maintenance. Dynamic Website System collaboration with OA office systems, knowledge management systems integration, Web site information is subject to the approval process for transfer of OA system, or after the adoption of knowledge management platform settings with external share permissions Caike officially released, realize simultaneous internal and external information distribution .
Document Management: System for seamless integration of multiple data sources, including: databases, documents (Office documents, PDF, AutoCAD, and even ZIP document), Web pages, FTP sites, etc., and to data by business requirements and analyze the characteristics of finishing functions , take the initiative to push through a unified Web interface (Push) to the user's portal desktop to help users make timely and correct decisions.
1.2.2 Portlet Container
Portlet Portlet container provides the execution environment, including many Portlet and manage their life cycle, preservation Portlet customized information.
A Portal Portal container receives a request from then passes the request to the existence of this Portal Portlet container implementation. Portlet container Portlet no obligation to portfolio generated content, this work must be handled by the Portal. Portal and Portal Container can be put together as a single system component, or separate into two independent components.
Portlet container is an extension of ordinary Web Servlet container, so a Portlet container can be built on an existing Servlet container or may be all the Web Servlet container to achieve full functionality. Portlet containers regardless of how achieved, its operating environment is always assumed that it supports Servlet2.3 specification.
Usually, Portlet Container Servlet container extended from the ordinary.
III What is the Portlet
Portal Portlet is the most important component, is responsible for the content of the Portal in the present information, there is a corresponding life cycle. Through custom Portlet, users can easily define personalized Portal page. Managed by the Portlet container Portlet, processing the request and returns the dynamic page that can be plug and play as the Portal of the interface components.
A Portlet is a Java technology for technology's Web component, managed by the Portlet container, specializing in customer information request and produce a variety of dynamic content. Portlet for the Pluggable client interface components to provide a presentation layer of information systems.
The content generated by the Portlet is called segment, while the fragment is marked with a number of rules (HTML, XHTML, WML), and other fragments can be composed of a complex document. One or more of the Portlet's content aggregation to become a Portal page. The Portlet Portlet life cycle are managed by the container control.
Interaction between the client and by the Portal Portlet The typical request/response be achieved, the normal term, for the customers and the Portlet Chansheng the Neironghudong, example, according to the next step of the connection or is Queren send the form, the results Portal Portlet action will be received, the status of turning this into the target Portlet. The Portlet generate the content for different users may have different changes, in full accordance with customer for the Portlet settings.
1.3.2 Portlet and Servlet relationship
Portlet is defined as a new component, with a new interface and behavior clear. In order to integrate as much as possible with the existing Servlet to re-use purposes, Portlet specification use of the Servlet specification, many concepts are similar, combined with Portlet, Servlet and Jsp system at the same site, we called the Portlet Application. Portlet applications in the same, they will share the same class loader (ClassLoader), context (Context) and the Session.
① , Portlet and Servlet similarities
@ Portlet components are Java technology web
@ Portlet is a specific container in the management
@ Portlet can dynamically generate a variety of content
@ Portlet lifecycle managed by the container
@ Portlet and client interaction is through the request / response mechanism
② , Portlet and Servlet are also some different
@ Portlet markup information generated only fragments, not full page document. The Portal will be all the Portlet markup fragments into a comprehensive information Portal website.
@ Portlet will not directly related to URL
@ Client must be through the portal system and Portlet Interaction
@ Portlet some defined request processing, action request and the render request.
@ Portlet Portlet modes and window defined default state can be pointed out that the page on which the Portlet functionality is being implemented and the current state.
@ Portlet can be in the same portal into multiple pages.
③ , Portlet some additional features are not available Servlet
@ Portlet can access and permanent storage of configuration files and custom information.
@ Portlet can access user data
@ Portlet with the URL rewrite functions in the file to dynamically create links that allow portal server do not have to know how to create links among Web pages and fragments of action.
@ Portlet can store temporary data in the Portlet session being, with two different areas:
application-wide scope and Portlet private scope.
④ , Portlet does not have some features, but there is provision of Servlet
@ Servlet has set the output encoding (character set encoding) mode
@ Servlet can set the HTTP header output
@ Servlet able to receive customer requests for the portal URL given
1.3.3 Portlet life cycle
A Portlet has a good life-cycle management, defines how to load, instantiate and initialize, and how to respond to a request from the client and how to send services. The Portlet Life Cycle from the Portlet interface init, processAction, render and destroy means to express.
Loading and instantiation: Portlet Container is responsible for loading and instantiating Portlet. Portlet when the Portlet Container running applications or delay to the needs of service users Portlet request, Portlet will be loaded and instantiated. After loading class Portlet, Portlet class to be instantiated immediately.
Initialization: Portlet class is instantiated, Portlet Container also need to initialize Portlet. To invoke the Portlet to respond to client requests. Portlet container calls the init method of Portlet interface initialization Portlet. The class can be extended out from the PortletConfig defined in the deployment descriptor file in the initialization parameters, and Resource Bundle.
Initialization exception: During initialization the Portlet, Portlet may throw PortletException UnavailableException or abnormal. At this point, Portlet Container Portlet can not be activated into service, and required the release of the Portlet container Portlet. destory method can not be called because the initialization is considered to fail. After the failure occurred, Portlet container will try to re-instantiate and initialize Portlet. The exception handling rules: from a UnavailableException specify a minimum time can not be executed when this exception occurs, Portlet Container Bixu to wait until after the specified time in the past generate and initialize a new Portlet.
Throw in the initialization process of the Runtime Exception exception, be treated as PortletException to deal with.
IV Liferay Portal works
Portal system as required by one or more Portal pages, each Portal page contains zero or more of the Portlet. Each Portlet present their own content, in order to achieve content aggregation. Available by defining the rights of each Portlet realize personalized information customized desktop.
1.4.1 Portlet style and window states
JCP organization of JSR168 Portlet specification defines a standard of achievement. Each Portlet external performance of a small window, have their own default style and window state. Shown above, Portlet has its own title, visit the state to support editing , close, move up, down, maximize, minimize function, edit, state support for return and shut-down. Extracted from various data sources of information to Portlet content in the form presented in the Portal.
Portlet style that is in any mode Portlet, Portlet usually based on the mode in which the implementation of different tasks and have different content.
Portlet Portlet mode to determine what it is that the show and what action the Executive. When calling a Portlet, Portlet Portlet container provides a model for the Portlet. When the action when dealing with a request, Portlet mode can use procedures to change.
JSR168 Portlet Specification defines three modes: view, edit and help, Liferay Portal supports all three modes in which. Portal is also the role of the user to decide is to provide (display) among Portlet mode to the user operation.
For example, anonymous users can browse and help to the operation mode of the contents of the Portlet, but had only authorized users can edit the Portlet mode of operation of the content provided or action.
In view of this Portlet mode, which is expected to provide the function is to generate markup language to represent the state at this time Portlet. For example, Portlet browsing patterns can contain one or more of the screen allows users to view and interact with the user interaction or that do not require a static content.
In the edit mode this Portlet, Portlet need to provide content and logic to allow users to customize the Portlet behavior. Typical that the edit mode will set or update Portlet Portlet parameter settings.
In helping this mode, Portlet should provide help information on this Portlet. This help information can be related to the Portlet's simple and coherent explanation of Windows or detailed description of the context. The Portlet does not need to have all the help that pattern.
A Portlet window states can decide on one page, how many in the room. When you call when a Portlet, Portlet Container Portlet need to tell the current window state. Portlet window states can then decide how much information to make it the right treatment. In the course of processing the request, Portlet way through the process to change the window state.
1.4.2 Portal Page
Each Portal page contains zero or more Portlet small window presents a complete information page. Portal Portlet after startup configuration file according to information such as the title of such property to Portlet assignment, given Portlet editor, close the other control buttons, so that a standard Portlet Portlet window. Portlet Portlet window of these combined to form a complete document, that Portal page. Each Portlet which are in the appropriate layout, showing pre-defined content, the quality of the performance of Portal public. Portlet can also switch between different layouts. Portlet to respond to client requests, and submit the request to the appropriate URL for logic processing.
Portlet development is completed, the deployment to Portal Server, the Portal server is responsible for organization, access control and presentation. Portal page creation process is as follows:
The implementation of the Portlet container Portlet, Portlet Container Portlet generated content to receive. Portlet containers will normally be submitted to the Portlet the content server, Portlet Portal server set up in accordance with the content page, and then pass it to client presentation. Specific processes as below:
Portal page of the request process is as follows:
Users via client devices (such as browsers) to access Portal, Portal according to the received request to determine which need to be performed Portlet to meet the demand. Portal by Portlet container call Portlet, then the resulting fragments to establish Portal Portlet page, and transmits it back to the client presented to the user. Specific processes as below: