Learn all about the second version of the Java Portlet Specification (JSR ). In Version , the specification and the APIs more than doubled. The Java Portlet Specification addresses the requirements of aggregation, was approved by the Java Community Process in March as JSR This tutorial on JSR development provides an introduction to portlet programming as the reader is taken through the creation of a simple HelloWorld portlet.
|Published (Last):||13 August 2016|
|PDF File Size:||19.31 Mb|
|ePub File Size:||18.83 Mb|
|Price:||Free* [*Free Regsitration Required]|
The main xpecification features of version speification. The QName and alias names are used to connect public render parameters of different portlets. Do not add new methods on the wrapper; there may be other wrappers in the chain that you don’t know of, and thus the portlet may not be able to access your new method. The Java Portlet Specification defines a contract 28 the portlet container and portlets and provides a convenient programming model for Java portlet developers.
This attribute is set on a request targeted to a portlet, indicating the current portlet life-cycle phase of this request. This markup is intended to be aggregated with other markup fragments into a larger application, for example, a portal page as shown in figure 1.
JSR specifications offer suitability to the developers to reuse the code to speciffication a set of JSR compliant portlets. The portlet programming model now provides you with events and public render parameters so that you can build larger composite applications out of your portlets and reuse your portlets in different scenarios. A JSR portlets catalog makes sure that portlets under this catalog may run on any standards—compliant Java portal server. If something has changed in the back-end system, then you produce new markup and set the setting to false.
How can the portlet get access to these public render parameters? A portlet container receives requests from the portal to execute requests on the portlets hosted by it.
Note that when you use wrappers, you should stick to the wrapper pattern and only override existing behavior. Therefore, you need to porrtlet this information in the portlet. The portal administrator or business user has now put these three portlets on a page and created connections between the sending portlet Portlet 1 and the receiving portlets Portlet 2 and Portlet 3.
The only way to share data between the portlet and the servlet is s;ecification use the application-scope session or the parameter on the URL that invokes the servlet. If you have portlets that are not customizable and don’t display different content for different users, such as a news-of-the-day portlet, then you get a cache entry for each user, even if all entries are the same. JSR allows portlets to send and receive events.
The specification and the APIs more than doubled compared to version 1. Portelt addition means that you can now dispatch to action or event logic written in a servlet, or you can do forwards when serving resources try to specfiication to the resource ID that you have set on a ResourceURL.
Standard portlet API
Create Spring Portlet in Liferay. You can specify a full QName for each event, or if you use the same namespace for many events, you can declare it as the default namespace and then specify only the local part of each event. You portoet view these public render parameters as a shared storage area where all participating portlets can set and get the values.
Defining a public render parameter portlrt very similar to defining an event: With the help of Ajax we can avoid render all portlets in page.
Standard portlet API
A servlet request listener can distinguish a plain servlet request targeted to a servlet from a wrapped servlet request targeted to a portlet by looking at the request attribute javax. Note, however, that no life-cycle calls are defined around the portlet window, so if you use the portlet window ID for specifying namespace entries in a persistent data store, you also need to clean up these entries yourself. If nothing has changed in the back-end system, you validate that the expired cache content is still valid to spdcification by setting the CacheControl.
Subscribe me to comment notifications. The new Portlet Specifications will add functionality that was not addressed in the first version specification, other JSRs were not final at the time JSR went to public review e.
What’s new in the Java Portlet Specification V2.0 (JSR 286)?
For example, the portlet can set a HTTP status code. The second version tackles these issues and provides solutions so that the portlet programming model has nearly the same capabilities as the servlet one, plus the portlet specific extensions.
These two parts are needed as some portal implementations, such as WebSphere Portal, stream the page and portlet output directly to the client to avoid buffering overhead. This behavior means that you can turn most JSR portlets into a JSR portlet by changing the one line in the portlet deployment descriptor that references the schema to the new V2. We can portlet related filters and Listeners in portlet portlet.
In this section, we cover various smaller additions that can make your life easier and that can support new use cases, such as the new Java 5 features leveraged in the API, the new caching features, the changes in the runtime IDs that you can access, and the porglet lib additions.
If you want to specifically access only public render parameters in your code, then msr can also use the method getPublicParameterMap on porttlet request. To support these use cases, Jsf introduces the portlet-managed modes that are not known to the portal, but are managed by the portlet itself. The second version lets you use forward and include and lets you use them in all life-cycle methods.
The speclfication also can enhance the cacheability of resources in other ways, for example by keeping track of the state changes on the client and re-rendering only the parts affected by state changes.
Now the user interacts with Jxr 1 and triggers an action on Portlet 1. A portlet can aggregate integrate and personalize content from different sources within a web page.
A Portlets Catalog is a set of portlets that are ready-to-use components for enterprise portals. In this case, GenericPortlet automatically dispatches to the given JSP, which can then make use of the portlet state information by including the portlet tag library. About Me Meera Prince. This capability opens the possibility to create new functionality by combining existing components into business mashups in a similar fashion to popular Web 2. Each filter gets the current request and response, or a wrapped version created by a preceding filter, and the filter chain.
This design point means that all portlets written against the V1. Note that if you use a container runtime option and the container on which your portlet is deployed does not support this option, the container may reject the deployment of the portlet. We need to deploy portlet in portal we simply use this protocol we can access other portlet which are in other portlet container.
JSR does not specify how connections for portlet coordination are defined and managed. The resource request has similar methods to the render request, but in addition it lets you get access to upload data. Specifying the shared property enables the portal to use only one version of such shared resources per page. Serving static resources using the portlet’s serveResource method causes unnecessary performance overhead. If this specification, or a future version of this specification, is included in dpecification future version of a Java platform specification, this specification will remain available for use outside the platform specification, and will continue to be evolved outside the platform specification.