The resource serving feature provides the ability for a JSR 286 portlet to serve a resource.
Portlets can create two different kinds of resource links in order to serve resources:
1. Direct links to the resource in the same portlet web application. These links are constructed by the portlet and encoded with the PortletResponse.encodeURL() method. (This method might not return a valid URL. And direct links are not guaranteed to pass through the portal server and will not have the portlet context available. Direct links should be used for use cases where the access to the portlet context and access through the portal is not needed, as they are more efficient than resource serving requests via resource URLs through the portal.)
2. Resource URL links pointing back to the portlet. Via these links the serveResource method of the ResourceServingPortlet interface is called and the portlet can serve the resource. Thus resources served via resource URLs may be protected by the portal security and can leverage the portlet context. Static resources should still be served with direct links in order to allow portal applications to configure and optimize static resource serving in a consistent manner.
(Ref: JSR286 portlet specification, Click here to download the full specification.)
Portlets can create two different kinds of resource links in order to serve resources:
1. Direct links to the resource in the same portlet web application. These links are constructed by the portlet and encoded with the PortletResponse.encodeURL() method. (This method might not return a valid URL. And direct links are not guaranteed to pass through the portal server and will not have the portlet context available. Direct links should be used for use cases where the access to the portlet context and access through the portal is not needed, as they are more efficient than resource serving requests via resource URLs through the portal.)
2. Resource URL links pointing back to the portlet. Via these links the serveResource method of the ResourceServingPortlet interface is called and the portlet can serve the resource. Thus resources served via resource URLs may be protected by the portal security and can leverage the portlet context. Static resources should still be served with direct links in order to allow portal applications to configure and optimize static resource serving in a consistent manner.
(Ref: JSR286 portlet specification, Click here to download the full specification.)