论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
Wolfgang Duttlinger
Getting customized portal preferences instead of default values
2013年2月15日 上午5:51
答复

Wolfgang Duttlinger

等级: New Member

帖子: 9

加入日期: 2012年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:

 1
 2import java.io.IOException;
 3import javax.portlet.PortletException;
 4import javax.portlet.RenderRequest;
 5import javax.portlet.RenderResponse;
 6import com.liferay.util.bridges.mvc.MVCPortlet;
 7import com.liferay.portal.kernel.util.PrefsPropsUtil;
 8
 9public class eClinicalLogin extends MVCPortlet {
10    @Override
11    public void doView(RenderRequest renderRequest,
12            RenderResponse renderResponse) throws IOException, PortletException {
13       
14        try {
15            renderRequest.setAttribute("casServerUrl", PrefsPropsUtil.getString("cas.server.url"));
16            renderRequest.setAttribute("casServiceUrl", PrefsPropsUtil.getString("cas.service.url"));
17        } catch (Exception e) {
18            // TODO Auto-generated catch block
19            e.printStackTrace();
20        }
21
22        super.doView(renderRequest, renderResponse);
23    }
24   
25}


This code returns the default values of the properties instead of my configured preferences. Does anyone know how to get my customized values?
Hitoshi Ozawa
RE: Getting customized portal preferences instead of default values
2013年2月15日 上午6:09
答复

Hitoshi Ozawa

等级: Liferay Legend

帖子: 7949

加入日期: 2010年3月23日

最近的帖子

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
RE: Getting customized portal preferences instead of default values
2013年2月15日 上午6:20
答复

Wolfgang Duttlinger

等级: New Member

帖子: 9

加入日期: 2012年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

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!