Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Wolfgang Duttlinger
Getting customized portal preferences instead of default values
February 15, 2013 5:51 AM
Answer

Wolfgang Duttlinger

Rank: New Member

Posts: 9

Join Date: August 30, 2012

Recent Posts

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
February 15, 2013 6:09 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

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
February 15, 2013 6:20 AM
Answer

Wolfgang Duttlinger

Rank: New Member

Posts: 9

Join Date: August 30, 2012

Recent Posts

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!