001
014
015 package com.liferay.portlet.iframe.action;
016
017 import com.liferay.portal.kernel.portlet.DefaultConfigurationAction;
018 import com.liferay.portal.kernel.util.CharPool;
019 import com.liferay.portal.kernel.util.HttpUtil;
020 import com.liferay.portal.kernel.util.StringUtil;
021
022 import javax.portlet.ActionRequest;
023 import javax.portlet.ActionResponse;
024 import javax.portlet.PortletConfig;
025
026
029 public class ConfigurationActionImpl extends DefaultConfigurationAction {
030
031 @Override
032 public void processAction(
033 PortletConfig portletConfig, ActionRequest actionRequest,
034 ActionResponse actionResponse)
035 throws Exception {
036
037 String src = getParameter(actionRequest, "src");
038
039 if (!src.startsWith("/") &&
040 !StringUtil.startsWith(src, "http:
041 !StringUtil.startsWith(src, "https:
042 !StringUtil.startsWith(src, "mhtml:
043
044 src = HttpUtil.getProtocol(actionRequest) + ":
045
046 setPreference(actionRequest, "src", src);
047 }
048
049 String[] htmlAttributes = StringUtil.splitLines(
050 getParameter(actionRequest, "htmlAttributes"));
051
052 for (String htmlAttribute : htmlAttributes) {
053 int pos = htmlAttribute.indexOf(CharPool.EQUAL);
054
055 if (pos == -1) {
056 continue;
057 }
058
059 String key = htmlAttribute.substring(0, pos);
060 String value = htmlAttribute.substring(pos + 1);
061
062 setPreference(actionRequest, key, value);
063 }
064
065 super.processAction(portletConfig, actionRequest, actionResponse);
066 }
067
068 }