I am trying to develop a Liferay portlet which will store users preference. This portlet will perform an AJAX call to refresh it content and uses those preferences to fetch data. For this I am using com.liferay.portal.kernel.portlet.DefaultConfigurationAction. Things are working fine if I did not make any changes to Look and Feel.
However when I specify a page to be linked to (Look and Feel -> Link Portlet URL to Page), user settings will be gone and default values will be used instead.
Through debugger I found out that there is no preference found when Look and Feel changes being applied.
Is there a fix for this?
I have managed to fix the problem. It seems that Liferay's IPC does not play well with AJAX.
As mentioned in the question, I set a target URL for this portlet's content to be pointing to. To generate the URL for the AJAX call I use
<portlet:resourceURL var="ajaxResourceURL" />
This tag however generates URL which points to the target URL instead of the current page itself. Thus when an AJAX call being made there is no data as the targetted page does not have the same portlet.
My fix for this is to replace the generated URL's path with the current page's path using javascript.
var url = '<%= ajaxResourceURL %>';
var path = url.substring(url.lastIndexOf("/") + 1, url.indexOf("?"));
var pathname = window.location.pathname;
pathname = pathname.substring(pathname.lastIndexOf("/") + 1, pathname.length);
url = url.replace(path, pathname);
Hopefully this will help those who face the same problem in future.