Effect of setCacheability on resource URL

With the setCacheability method on the ResourceURL the portlet can indicate that it only needs parts of the overall state via the cache level parameter and thus the portal application can create URLs that result in an increased likelihood of a subsequent browser access being served from a browser/web cache. With the getCachability method on the ResourceURL the portlet can retrieve the current cache level.

  • FULL – The resource URL does not need to contain the current state of the page or the current render parameters, portlet mode, or window state of the portlet. Thus the portlet should not access the portlet mode, window state, or render parameters in the serveResource call.URLs of the type FULL have the highest cacheability in the browser as they do not depend on any state of the portlet or page.

  • PORTLET – The serveResource call triggered by a PORTLET resource URL does have access to the portlet state consisting of the render parameters, portlet mode and window state.URLs of the type PORTLET are cacheable on the portlet level in the browser and can be served from the browser cache for as long as the state of this portlet does not change

  • PAGE – The resource URL may contain artifacts that require knowledge of the state of the complete page, like PortletURLs, or resource URLs of type PAGE. The markup returned by such a resource URL may contain any portlet URL. Resource URLs of the type PAGE are only cacheable on the page level and can only be served from the browser cache as long as no state on the page changes.

I tried building a sample URLCacheabilityPortlet to see how the URL Cacheability works but it seems that it does not work as described in the portlet specification either in the Apache Pluto or WebSphere Pluto, but i could see that portal server is generating different URLs for serveResource depending on the Cacheability level

public class URLCacheabilityPortlet extends GenericPortlet{
protected void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
System.out.println("Entering URLCacheabilityPortlet.doView()");
getPortletContext().getRequestDispatcher("/view.jsp").include(request, response);
System.out.println("Exiting URLCacheabilityPortlet.doView()");
public void serveResource(ResourceRequest request, ResourceResponse response)
throws PortletException, IOException {
System.out.println("Entering URLCacheabilityPortlet.serveResource()");

ResourceURL fullCachableURL = response.createResourceURL();
fullCachableURL.setProperty(ResourceURL.SHARED, "TestQName");
request.setAttribute("fullCachableUrl", fullCachableURL.toString());

ResourceURL pageCachableURL = response.createResourceURL();
request.setAttribute("pageCachableURL", pageCachableURL.toString());

ResourceURL portletCacheableURL = response.createResourceURL();
request.setAttribute("portletCacheableURL", portletCacheableURL.toString());
getPortletContext().getRequestDispatcher("/index.jsp").include(request, response);
System.out.println("Entering URLCacheabilityPortlet.serveResource()");

When i did add two instances of this portlet on one websphere portal page this is the output that i got


srjwebsolutions said...

We are leading responsive website designing and development company in Noida.
We are offering mobile friendly responsive website designing, website development, e-commerce website, seo service and sem services in Noida.

Responsive Website Designing Company in Noida
Website Designing Company in Noida
SEO Services in Noida
SMO Services in Noida

Vikas Chaudhary said...

Battery Mantra is Authorized exide car battery dealer in Noida and Greater Noida. We are providing our service in Indirapuram, Delhi, Ashok Nagar.

Exide Battery Dealer in Noida
Battery Dealer in Noida
Authorized Battery Dealer in Noida
Car Battery Dealer in Noida
Car Battery Dealer
Exide Battery Dealer

EG MEDI said...

Egmedi.com is online medical store pharmacy in laxmi nagar Delhi. You can Order prescription/OTC medicines online.
Cash on Delivery available. Free Home Delivery

Online Pharmacy in Delhi
Buy Online medicine in Delhi
Online Pharmacy in laxmi nagar
Buy Online medicine in laxmi nagar
Onine Medical Store in Delhi
Online Medical store in laxmi nagar
Online medicine store in delhi
online medicine store in laxmi nagar
Purchase Medicine Online
Online Pharmacy India
Online Medical Store