Portal Open Source Implementation-liferay portlet Session processing (1)

Source: Internet
Author: User
Tags sessions
Session
One, the description of the session in the specification

(Portletsession objects must is scoped at the Portlet, application the context level.) Each portlet application has its own distinct the Portletsession object per user session. The Portlet container must not share the Portletsession object or the attributes stored in it among portlet different Ications or among different user sessions.) The above passage is a section of the Portlet specification. As you can see, each portlet application should have its own private session object in process action and render to serve the current user. That is, if a user operates a different portlet in a portal system, and the portlets belong to different portlet application, the user will manipulate multiple session objects. When a user operates a session in each Portlet, the session will be a private session object that belongs to the context in which the portlet resides. For example, the user's current page has three portlets, each of which belongs to a different portlet application. The application that the portlet belongs to will generate a session for the user when the user has an action on the session in the first Portlet, and when the user operates the session in the second Portlet, The context has a new session object for this user, and the third remains the same. Plus the portal system session, that is, the user actual and four sessions in the big dealings.

Also to illustrate the relationship between PORTLET application and Web application. The specification has the following definitions: (Portlets, Servlets and JSPs are bundled in a extended web application portlet called. Portlets, Servlets and JSPs within the same Portlet application class share, loader context and session. This means that the portlet application is actually a Web application. There is also a paragraph in the specification that illustrates this issue, while also emphasizing the relationship between Portlet session and the regular Application sessions: (a portlet application is also a WEB application. The Portlet application may contain servlets and JSPs into addition to portlets. Portlets, Servlets and JSPs may share information through the session. The portletsession must store all attributes in the HttpSession of the Portlet application. A Direct consequence of this is that data stored in the HttpSession by Servlets or JSPs was accessible to portlets through The portletsession in the Portlet application scope. Conversely, data stored by portlets in the portletsession on the Portlet application scope is accessible to servlets and J SPs through the HttpSession. If the HttpSession object is invalidated, the Portletsession object must also to invalidated by the portlet. If the Portletsession object is invalidated by a portlet, the Portlet container must invalidate the associated HttpSession Object.)

The last point to illustrate is how to get the Portlet session object. There is an example in the specification: portletsession session = Request.getsession (true); URL url = new URL ("http://www.foo.com"); Session.setattribute ("Home.url", Url,portletsession.application_scope); Session.setattribute ("Bkg.color", "RED", Portletsession.portlet_scope);


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.