Pages

Tuesday, 23 April 2013

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);

No comments:

Post a Comment