留言板

Getting customized portal preferences instead of default values

Wolfgang Duttlinger,修改在11 年前。

Getting customized portal preferences instead of default values

New Member 帖子: 9 加入日期: 12-8-30 最近的帖子
Hey there,

In the control panel under portal seetings -> authentication -> cas i made some configuration.

In a custom portlet i need to have access to these preferences I made in the control panel. I tried following code:


import java.io.IOException;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import com.liferay.util.bridges.mvc.MVCPortlet;
import com.liferay.portal.kernel.util.PrefsPropsUtil;

public class eClinicalLogin extends MVCPortlet { 
	@Override
	public void doView(RenderRequest renderRequest,
			RenderResponse renderResponse) throws IOException, PortletException {
		
		try {
			renderRequest.setAttribute("casServerUrl", PrefsPropsUtil.getString("cas.server.url"));
			renderRequest.setAttribute("casServiceUrl", PrefsPropsUtil.getString("cas.service.url"));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		super.doView(renderRequest, renderResponse);
	}
	
}


This code returns the default values of the properties instead of my configured preferences. Does anyone know how to get my customized values?
thumbnail
Hitoshi Ozawa,修改在11 年前。

RE: Getting customized portal preferences instead of default values

Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
I haven't checked for CAS settings but portal preferences are usually accessed by PortalPreferencesLocalServiceUtil http://docs.liferay.com/portal/6.1/javadocs/com/liferay/portal/service/PortalPreferencesLocalServiceUtil.html
Wolfgang Duttlinger,修改在11 年前。

RE: Getting customized portal preferences instead of default values

New Member 帖子: 9 加入日期: 12-8-30 最近的帖子
Thanks for your answer.

Actually i use Version 6.0.5 and it seems like PortalPreferencesLocalServiceUtil doesn't exist there.

I found a PortletPreferencesLocalServiceUtil, which doesn't seem to be the right one, too.

Do you have any further advice?

Best regards, Wolfgang