 |
OpenPortal? WSRP Project : WSRP version 2.0 milestone 3 - Feature Preview Document
If you have not installed the WSRP version 2.0 milestone 3 binary, please follow the instructions available in the glassfish install guide or tomcat install guide before you proceed.
The WSRP v2 milestone 3 previews the following features
- WSRP 2.0 getResource
- WSRP 2.0 Caching
- Markup Caching
- Resource Caching
- Tomcat 5.5 support
- Migrated code to the latest WSRP 2.0 schema
This document allows users to use and experiment with the above implemented by means of providing samples.
- If you would like to keep track of future announcements and additions to the OpenPortal? WSRP Project, please subscribe to the announce@wsrp.dev.java.net alias.
- If you have questions on how to use the OpenPortal? WSRP Project and other comments/suggestions/requests, we urge you to join the users@wsrp.dev.java.net alias.
- Please report any issues that you encounter while trying WSRP version 2.0 milestone 3 binary to issues@wsrp.dev.java.net.
Note: WSRP version 2.0 milestone 3 binary is tested and works only with Portlet Container 2.0 - 11 March 2008 nightly binary only.
A. GetResource?:
The resource serving feature enables a portlet to serve a resource. Portlets can create two kinds of resource links to serve requests:
- Direct links to the resources in the same portlet web application.
- Direct links are not guaranteed to pass through the portal server and will not have portlet context available. So a direct link should be used in cases where access to the portlet context and access through portal server is not needed.
- Resource URL links that point back to the portlet.
- These links call the serveResource() method of ResourceServingPortlet?. This way, the portlet can serve a resource that is protected by the portal security and can leverage the portlet context. Portlet container does not render any output in addition to the content returned by the serveResource call. Thus, the serveResource() method provides more control to you by giving access to write directly on the response object where portal server just acts as a proxy.
If you need more information on how to write a JSR 286 Portlet that implements getResource() call refer to the following document Understanding the Portlet Container 2.0 Beta
In WSRP these 2 ways of serving resources are captured as Inband and Out of band mechanisms of resource serving.
A.1. Inband Resource Serving:
To demonstrate the WSRP inband resource serving functionality we'll use the following sample portlet Binary , Source
The above Invoice Portlet. When the user selects a invoice number in the drop-down box, an asynchronous request (Ajax call) is made by the JavaScript? client to the WSRP Consumer. The WSRP Consumer translates this to a getResource() method call on the WSRP Producer which invokes the serveResource() method on the portlet and the content is served by the portlet.
To test the above portlet via WSRP
- Deploy the above portlet application war using the portletdriver admin tab.
- Makes sure that the portlet is working by testing the portlet on the portlet tab.
- Create a WSRP Producer called "ServeResourceProducer" using the WSRP Producer Admin Portlet.
- Publish the above portlet and enable the above producer.
- Create a WSRP Consumer using using the WSRP Consumer Admin Portlet provide the WSDL URL of the producer.
- Upon successful Consumer creation. Create a WSRP Remote Window by clicking on "create" link on the WSRP Consumer admin portlet
- View the portlet on the WSRP tab.
- Choosing a invoice from dropdown on the portlet invokes the serveResource() operation on the portlet via WSRP.
Here is a screenshot of the InvoicePortlet? application
A.2. Out-of-band Resource Serving:
To demonstrate the WSRP out-of-band resource serving functionality we'll use the following sample portlet Binary , Source
The above GuessNumber? Portlet, generates a link to an image(resource) that is deployed within the same portlet application. This portlet does not implement the serveResource() method rather the resource/image is served by the webcontainer. So the portlet developer has no control over generating the resource.
To test the above portlet via WSRP
- Deploy the above portlet application war using the portletdriver admin tab.
- Makes sure that the portlet is working by testing the portlet on the portlet tab.
- Create a WSRP Producer called "OutbandResourceProducer" using the WSRP Producer Admin Portlet.
- Publish the above portlet and enable the above producer.
- Create a WSRP Consumer using using the WSRP Consumer Admin Portlet provide the WSDL URL of the producer.
- Upon successful Consumer creation. Create a WSRP Remote Window by clicking on "create" link on the WSRP Consumer admin portlet
- View the portlet on the WSRP tab.
- The duke image that this portlet displays is fetched out of band by the WSRP Consumer
Here is a screenshot of the GuessNumber? Portlet application
B. Caching:
The consumer module in WSRP v2 milestone 3 is providing support for markup as well resource caching. Both, markup and resource caching supports expiration as well as validation caching as mentioned in WSRP v2 specification. Caching feature is available for authenticated user only.
Markup caching:
In case of markup caching, the content are being cached by the wsrp consumer. To demonstrate the WSRP markup caching functionality we'll use MarkupCachePortlet? available here , [Source]
MarkupCachePortlet? is only using expiration caching and can be modified to add validation caching also. The expiration time is defined as 120 seconds in portlet.xml. This portlet generates markup containing current date-time string. The generated content is being cached for the expiration time (e.g. 120 sec) mention in portlet.xml. Therefore, for any logged in user, the markup (the date-time string) should NOT be changed by clicking browser refresh button or interacting with other portlets on the page, for next 120 sec after the last execution of render. But, after clicking render or action URL, the portlet should show a new date-time string.
Resource caching
In case of resource caching, the content are being cached by the browser and consumer cache has no data caching at its end. To demonstrate the WSRP markup caching functionality we'll use the ResourceCachePortlet? available
here , [Source]
ResourceCachePortlet? is same as InvoiceAjaxPortlet? mentioned above. The only change ResourceCachePortlet? provides over InvoiceAjaxPortlet? is the addition of expiration cache entry in the portlet.xml. Since resource caching is implemented using browser caching feature, you need to test to snoop http request to see it working. Once way to achieve is this using 'Live HTTP Header' firefox plugin. Here are the steps to see it working:-
- Download and install 'Live HTTP Header' firefox plugin.
- Using firefox browser, login to portlet driver and deploy ResourceCachePortlet?.
- Creare wsrp channel for ResourceCachePortlet?.
- Go to WSRP tab and see whether you can see ResourceCachePortlet? there. Do NOT select any invoice at this moment.
- Select Live HTTP Header plugin using Tools menu option of browser.
- Now, Select any invoice, say 439089 from the invoice drop-down.
- See Live HTTP Header plugin window. You can see the http resource request entry there. This means, browser is sending a resource request to server. Clear this data.
- Repeate 6 & 7 for invoice 439090. Live HTTP Header plugin window will again show you some data.
- Repeate step 6. This time, you will find no request entry in Live HTTP Header plugin window. This means, browser has a cache for invoice 439090 and it is serving data from its cache.
C. Tomcat Installation:
Pls follow the instructions available on WSRP installation on Tomcat Guide to try this feature
D. Previous Milestone Features:
The WSRP Coordination Preview Guide provides the instructions to try out the samples that were part of the previous milestone build. Use the same document as reference, however do not use the binaries that are mentioned in the above guide rather download the latest samples from Portlet Container 2.0 Beta 2 Samples
E. Related documents:
- WSRP installation on Glassfish
- WSRP installation on Tomcat
- WSRP User Guide
- Sample Portlets from OpenPortal Portlet Repository
-- Main.t_rajesh - 06 Mar 2008
|