JSR 286 SPECIFICATION PDF

adminComment(0)

JSR Schedule. Kick-off: Feb Early draft 1: Aug Early draft 2: April Public draft: July Final draft: Dec Approved: Mar Size of specification. Required Files. File Description and Name, Size. JSR Portlet Specification schema gonddetheppolad.ga, KB. JSR Portlet Specification JSR Portlet Specification for Portal and Portlet Developers. JSR Portlet serving non-markup resources .pdf,.doc, images etc.) ○ portlet filters. ○.


Jsr 286 Specification Pdf

Author:MICAELA SCHABEL
Language:English, French, Arabic
Country:Dominica
Genre:Technology
Pages:215
Published (Last):11.11.2015
ISBN:666-4-30134-587-1
ePub File Size:25.61 MB
PDF File Size:11.37 MB
Distribution:Free* [*Sign up for free]
Downloads:29528
Uploaded by: HELEN

A short summary of JSR Portlet Specification JSR Enhancements and new features for serving non-html resources (pdf, doc, images etc.). Specification Leads. Martin Nicklous, IBM. Expert Group. Adobe Systems Inc.: Ed Solovey, Adobe Systems Inc.: James Ward, BEA Systems: Subbu Allamaraju. 1. Agenda. • JSR 2. • JSR – What Is Missing? • JSR • Portlet Events. 28 JSR defines a portlet specification with the following goals: – Simple . Portlet acts as a proxy to a resources, e.g. PDF documents. – Portlet.

Generally if any portlet is have in action page other portlet need to render the portlet within the page. With the help of Ajax we can avoid render all portlets in page.

We simply send Ajax call from portlet so that we can communicate with server then get the response. In JSR was added another feature called serving resources with help of this we can serve the images, pdf and other content types to client.

This method also used specially for Ajax call in portlet, to call this method we will use different URL i. Generally in the portlet transition state will always change from Action Phase to Render Phase when we perform actions. Portlet Filter and Listeners We can portlet related filters and Listeners in portlet portlet.

This will add advantage to perform some events or some actions before portlet is rendered. Support Many Web Application Frame works in Portal Container Generally Portal specification is different and we will use portlet container to manage portlets and its lifecycle. But we have many elegant web application frameworks. In JSR support other web frame works to run in portlet container so that developer can develop portlet in any web application frame work and run in the portlet container with help of small changes.

Support for WSRP 2.

This will help us access portlet from remote location other portals. We also learned that you can make some state changes in the serveResource call: Change the portlet preferences Change data in the portlet session scope You can now implement additional use cases such as asynchronous updates that make your user interface more responsive.

Figure 5. You can see that the Ajax calls go through the portal servlet and thus are under the control of the portal. Closing the gap to the servlet programming model The first version of the Java Portlet Specification restricted the portlet programming model in some areas compared to the servlet programming model. This restriction was done because portlets are aggregated on a page and all concepts that assume that you are the only component on the page are not easily applied to the portlet programming model.

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. Cookies, document head section elements, and HTTP headers In the first version of the Java Portlet Specification, the portlet could not contribute to sections of the portal page outside its portlet window.

In the second version, you can set cookies, document head section elements for example, HTML ones such as meta, link, or style and HTTP headers such as application-specific Pragma headers. Two-part rendering life-cycle call To overcome the problem that version 1. 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.

In this case, the portlet rendering cannot add anything to the head section of the document, as the head section is already written. Thus, portlets that want to contribute to the head section or to set a portlet title should turn on the two-part rendering feature with the setting shown in listing 3 in the portlet deployment descriptor.

Listing 3. The GenericPortlet class does the rest for you. Using cookies You can set cookies at the response of each life-cycle method processAction, processEvent, render, and serveResource with this code: response.

Cookie cookie The cookie can then be accessed in all life-cycle methods using: request. Cookies may not be accessible at the client because they are stored at the portal server or they are put in a different namespace when the portlet runs as a remote portlet through WSRP.

Cookies are not guaranteed to be shared across different portlets. Request dispatcher include and forward In the first version of the Java Portlet Specification, you had only the option of including servlets or JSPs from the render life-cycle call.

The second version lets you use forward and include and lets you use them in all life-cycle methods. This 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 forward to the resource ID that you have set on a ResourceURL. Leveraging the servlet life-cycle listeners In V1.

For notifications about the servlet context and the corresponding portlet context. For notifications about attributes in the servlet context or the corresponding portlet context. For notifications about changes to the attributes of the HTTPServletRequest or the mirrored portlet request of the current Web application. 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.

This attribute is set on a request targeted to a portlet, indicating the current portlet life-cycle phase of this request.

Access to all these life-cycle listeners gives you many hook points for managing objects related to these lifecycles, which is a great feature for many frameworks.

These hook points, though, come with a cost, especially the request lifecycle listeners, which add significant processing overhead for each request. Therefore, use them with care.

Container runtime options for leveraging additional container behavior, such as the two-part rendering. Let's take a deeper look into the new features for extending the Java Portlet Specification in the next sections. Portlet filters The new portlet filter functionality allows you to plug filters around any life-cycle call of the portlet.

Following the common decorator pattern, filters can do pre- or post-processing, and they can modify or wrap the request and response objects that are passed to the portlet. Typical applications of portlet filters could include these: Passing information from additional sources to the portlet as attributes or parameters Output filtering for security enforcement or markup compliance Collecting diagnostic information Bridging between Web application frameworks WebSphere Portal V6.

The portlet filter programming model is modeled on the servlet filter model: Define the filters in the deployment descriptor.

Subscribe to RSS

Implement the corresponding Filter interface in your filter. You can also list multiple life-cycle entries and implement multiple Filter interfaces with your class. Provide a filter-mapping element where you describe to which portlets your filter should be applied you can also use an asterisk as a wildcard if it should be applied to all portlets in the application.

The order of the filter-mapping elements in the deployment descriptor also defines the order of the filters that are applied to the portlet. Listing 4 shows an example for a deployment descriptor entry.

Listing 4. Each filter gets the current request and response, or a wrapped version created by a preceding filter, and the filter chain. After doing its preprocessing, the filter implementation can either terminate the request processing or call the next element in the filter chain, passing in either the received request and response or additional wrappers.

The last element in the filter chain is the portlet itself. Listing 5 is an example of a filter that does some pre- and post-processing and provides the portlet with a wrapped request. Listing 5. 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. If you want to provide the portlet with additional capabilities, set an object providing access to these capabilities as a request attribute.

One example involves implementing a mapping of resources to shared IDs. You need to register such a listener with the listener element in the portlet deployment descriptor, and your class needs to implement the PortalURLGenerationListener interface that defines a callback method for each type of portlet URLs: action, render, and resource. Portlet-managed modes In JSR , the portlet could leverage only portlet modes that are supported by the portal framework running the portlet.

Integration of standard Portlets (JSR 168 or JSR 286 )

In some use cases, the portlet wants to offer portlet-specific functionality with the same user look-and-feel as portlet modes supported by the portal for example, with context menus on the portlet window. For example, a ShowShoppingCart portlet mode lists all entries that you currently have in your shopping cart. To support these use cases, JSR introduces the portlet-managed modes that are not known to the portal, but are managed by the portlet itself.

The portlet can declare such a mode in the portlet deployment descriptor with the code shown in listing 6.

Liferay Development

Listing 6. This setting indicates to the portal that it should treat this mode just like the standard View mode concerning all aspects, including how it provides the portlet with preferences and from the perspective of access control. The portal should provide UI controls that allow the portlet to switch to this mode.

The portlet can define localized names for the decoration using the resource bundle entry: javax. Because the portal does not know specific semantics of the portlet-managed modes, it does not know when it makes sense to present a decoration to switch to a portlet-managed mode and when it does not. Therefore, the JSR specification lets you indicate for which portlet modes the portal should display UI controls as part of the render response using the method setNextPossiblePortletModes.

Note that you need to set this list of modes on each response and that you should enable the container runtime option javax. Container runtime options Container runtime options allow the portlet to supply specific options to the portlet container that either change default behavior defined in the Java Portlet Specification or add additional behaviors.

We've already seen an example of such a container runtime setting: the renderHeaders option. JSR defines a list of container runtime options that are all optional except for actionScopedRequestAttributes.

In addition to these options, specific portlet container implementations may provide their own options. You indicate that your portlet requires a specific container runtime option in the deployment descriptor using the code shown in listing 7.

Listing 7.

Java Portals and Java Portlet Specification and API

Enables the two-part rendering mechanism that lets you set headers in streaming-based portal implementations. Allows you to change the default scope of the session object provided to servlets or JSPs that are called from the portlet through forward or include from application scope to portlet scope. That way, these resources access the same session data using portlet and servlet APIs, which is particularly convenient if your JSPs are written for a servlet-based Web framework.

Allows Web frameworks to pass complex objects from the action or event phase to the render phase through the request. You are able to access these attributes until the next request with an action semantic which may be an action triggered through an Action URL or an event occurs.

This feature likely is implemented by the portlet container by storing these attributes in the session. Therefore, use this feature only if you cannot avoid it, as it will probably cause some performance degradation.

This option is the only one that JSR requires to be supported by all containers. 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. Use these options with care if you want to develop a portlet that can run on many different portlet container implementations.

Backward compatibility Java Portlet Specification V2. This design point means that all portlets written against the V1.

The only exceptions to this rule are the following slight behavior changes that normally should not break any portlets: RenderResponse. Calling getWriter or getOutputstream without previously setting the content type no longer results in an IllegalStateException in V2.

This backward compatibility statement also includes the deployment descriptor in which V2. 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.

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 tag lib additions. Java 5 features JSR leverages some of the new Java 5 features: Using Generics Introducing a new enum class for all user profile attributes GenericPortlet also lets you use the following annotations to make dispatching life-cycle calls to specific handler code easier: ProcessAction.

This annotation allows you to annotate a method that should process a specific action.

To allow dispatching, the Action URL needs to include the parameter javax. This annotation allows you to annotate methods that should process specific events. This annotation allows you to annotate methods that should render a specific portlet mode.

Listing 8 shows how you use the ProcessAction annotation. Listing 8.

For Java 1. New caching features JSR adds new caching features that help making portlets scale better: Public caching scope, which marks cache entries shared across users Support for multiple cached views per portlet Validation-based caching for validating expired cache entries In JSR , all cache entries were private for each user. 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.

Now, in JSR , you can tell the portlet container that the cache entry can be shared using the cache-scope element in the deployment descriptor. Thus, you can dramatically reduce the memory footprint for these portlets, as the code in listing 9 shows.

Listiing 9. We recommend that you do not change the cache scope programmatically, though, as it may be difficult for portlet containers to ensure that cache entries are invalidated correctly if your portlet mixes responses with cache scope public and private for the same user.

The JSR specification demanded that portlet containers must invalidate the cache for each user interaction with a portlet render or action URL , so that there could be only a single cache entry per portlet window and user. With the introduction of public render parameters and shared caching, the specification has been enhanced to allow the container to cache multiple portlet views based on render parameters.

Inter Portlet Communication

This enhancement means that you can use render parameters so that users can navigate between different views in a shared cacheable portlet while the output still remains cached. Only the action and event processing calls, which can cause side-effects that are not known to the container, now require a cache invalidation.

Validation-based caching is useful for situations in which you do not want to recompute the markup of a portlet often because it is an expensive operation. Ideally, set the expiration time to a high value so that the markup is cached for a long time. On the other hand, you may want to respond quickly to changes in your back-end system and provide an updated view of the portlet.

Validation-based caching solves this dilemma: It allows you to define a short expiration time so that your portlet gets called often and can check for changes in the back-end system. If nothing has changed in the back-end system, you validate that the expired cache content is still valid to use by setting the CacheControl.

If something has changed in the back-end system, then you produce new markup and set the setting to false. How do you know which back-end state the currently cached markup maps to? The portlet container can then provide you with this ETag in the request of the next render or serveResource call, indicating that it still has the cached content available, which can be revalidated.

An example of using validation-based caching is shown in listing Listing If, for example, the request to the back-end server takes up 90 percent of the time to render the portlet, it does not make sense to use validation-based caching to save only the remaining 10 percent rendering time. Runtime IDs Runtime IDs can be used to scope data that your portlet handles, so that you can avoid collisions between multiple occurrences of a portlet within the same portal, and maybe even on the same page.

Most portlet API objects, for example, portlet session or portlet preferences, do implicit namespacing, but you need to do explicit namespacing when you access shared data stores or want to assign unique IDs to output elements.

This practice is common for Ajax applications, which can particularly benefit from the two enhancements that version 2. This extension now allows you to use the namespace to also crate namespace form IDs if, for example, your portlet is intended to be aggregated in a forms-based portal server. You can also leverage the namespace for JavaScript function calls that are embedded in Ajax responses, and you can reuse namespaced JavaScipt functions provided by a previous render call.

This call now allows you to use this ID as key for data that you want to create namespace per portlet window; for example, the portlet wants to cache data that it received from a back-end system per portlet window. 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.

Taglib additions The JSR tag library has its own namespace so that new additions do not interfere with portlets using the old JSR tag library. For access to the portlet-scoped session.

For access to the portlet preferences. For copying the current private render parameters to the URL.Generally in the portlet transition state will always change from Action Phase to Render Phase when we perform actions. It still requires that the portlet packages these resources in its WAR file in case the portal has not already loaded the resource. In addition to these options, specific portlet container implementations may provide their own options.

From Wikipedia, the free encyclopedia. The Executive Committees would like to ensure Spec Leads understand the value of this transparency and ask that each JSR have an operating plan in place for how their JSR will address the involvement of the community and the public. Instead, you needed an additional servlet that served the resources. A Portlets Catalog is a set of portlets that are ready-to-use components for enterprise portals.

Unsourced material may be challenged and removed.

ELOUISE from Pasadena
I enjoy sharing PDF docs kindheartedly. Look through my other articles. I am highly influenced by horseball.
>