001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.layoutconfiguration.util;
016    
017    import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018    import com.liferay.portal.kernel.template.TemplateResource;
019    import com.liferay.portal.kernel.util.StringBundler;
020    import com.liferay.portal.layoutconfiguration.util.xml.RuntimeLogic;
021    
022    import javax.servlet.http.HttpServletRequest;
023    import javax.servlet.http.HttpServletResponse;
024    import javax.servlet.jsp.PageContext;
025    
026    /**
027     * @author Brian Wing Shun Chan
028     * @author Raymond Aug??
029     * @author Shuyang Zhou
030     */
031    public class RuntimePageUtil {
032    
033            public static StringBundler getProcessedTemplate(
034                            PageContext pageContext, String portletId,
035                            TemplateResource templateResource)
036                    throws Exception {
037    
038                    return getRuntimePage().getProcessedTemplate(
039                            pageContext, portletId, templateResource);
040            }
041    
042            public static RuntimePage getRuntimePage() {
043                    PortalRuntimePermission.checkGetBeanProperty(RuntimePageUtil.class);
044    
045                    return _runtimePage;
046            }
047    
048            public static void processCustomizationSettings(
049                            PageContext pageContext, TemplateResource templateResource)
050                    throws Exception {
051    
052                    getRuntimePage().processCustomizationSettings(
053                            pageContext, templateResource);
054            }
055    
056            public static void processTemplate(
057                            PageContext pageContext, String portletId,
058                            TemplateResource templateResource)
059                    throws Exception {
060    
061                    getRuntimePage().processTemplate(
062                            pageContext, portletId, templateResource);
063            }
064    
065            public static void processTemplate(
066                            PageContext pageContext, TemplateResource templateResource)
067                    throws Exception {
068    
069                    getRuntimePage().processTemplate(pageContext, templateResource);
070            }
071    
072            public static String processXML(
073                            HttpServletRequest request, HttpServletResponse response,
074                            String content)
075                    throws Exception {
076    
077                    return getRuntimePage().processXML(request, response, content);
078            }
079    
080            public static String processXML(
081                            HttpServletRequest request, String content,
082                            RuntimeLogic runtimeLogic)
083                    throws Exception {
084    
085                    return getRuntimePage().processXML(request, content, runtimeLogic);
086            }
087    
088            public void setRuntimePage(RuntimePage runtimePage) {
089                    PortalRuntimePermission.checkSetBeanProperty(getClass());
090    
091                    _runtimePage = runtimePage;
092            }
093    
094            private static RuntimePage _runtimePage;
095    
096    }