06 April, 2011

Get portlet preference

In many cases we need to find portlet preferences.
Below is the code which can help to find portlet preferences.

PortletPreferences preferences = renderRequest.getPreferences();
String portletResource = ParamUtil.getString(request, "portletResource");
if (Validator.isNotNull(portletResource)) {
preferences = PortletPreferencesFactoryUtil.getPortletSetup(request, portletResource);

String OAuthConsumerKey = preferences.getValue("OAuthConsumerKey", StringPool.BLANK);
String OAuthConsumerSecret = preferences.getValue("OAuthConsumerSecret", StringPool.BLANK);
String OAuthAccessToken = preferences.getValue("OAuthAccessToken", StringPool.BLANK);

Popular Posts

Featured Post

Liferay 7.3 compatibility matrix

Compatibility Matrix Liferay's general policy is to test Liferay Portal CE against newer major releases of operating systems, open s...