Monday, 8 February 2016

Get portlet preference

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