Ajax

Home Search

Ressources serving

Through the render method of the Portlet interface the Portlet produces its complete markup that is embedded as a fragment into the overall page by the portal application. However, there are use cases where the portlet would like to only replace a part of its markup, e.g. via an AJAX call. Serving fragments via serveResource is under the complete control of the portlet. Typically a portlet would issue an XMLHttpRequest with a resource URL and provide either markup or data as response in the serveResource method.

In order to provide a resource URL for each event handler that are supposed to serve either partial markup or data, the portletModule replaced the default implementation of the Linksource service by a class called PortletLinkSource.

more precisely the method called createComponentEventLink returns a resource URL when:

1) the event name start with the keyword "serve"

2) the component referenced by the link is declared as a resource sender.

The following code extracted from the PortletModule, show us how the bridge contributes values to the PortletResourceResponseIdentifier's configuration for components that come from tapestry-core and tapestry5-jQuery.

if you have to add a component to the list you have to:
- declare all the events raised by the component that request a resource serving url like

- declare only the events raised by the component that should be declared as a resource sender.

- declare a mixin that raised that should be declared as a resource sender.