001    /**
002     * Copyright (c) 2000-present 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    
025    /**
026     * @author Brian Wing Shun Chan
027     * @author Raymond Aug??
028     * @author Shuyang Zhou
029     */
030    public class RuntimePageUtil {
031    
032            public static StringBundler getProcessedTemplate(
033                            HttpServletRequest request, HttpServletResponse response,
034                            String portletId, TemplateResource templateResource)
035                    throws Exception {
036    
037                    return getRuntimePage().getProcessedTemplate(
038                            request, response, portletId, templateResource);
039            }
040    
041            public static RuntimePage getRuntimePage() {
042                    PortalRuntimePermission.checkGetBeanProperty(RuntimePageUtil.class);
043    
044                    return _runtimePage;
045            }
046    
047            public static void processCustomizationSettings(
048                            HttpServletRequest request, HttpServletResponse response,
049                            TemplateResource templateResource)
050                    throws Exception {
051    
052                    getRuntimePage().processCustomizationSettings(
053                            request, response, templateResource);
054            }
055    
056            public static void processTemplate(
057                            HttpServletRequest request, HttpServletResponse response,
058                            String portletId, TemplateResource templateResource)
059                    throws Exception {
060    
061                    getRuntimePage().processTemplate(
062                            request, response, portletId, templateResource);
063            }
064    
065            public static void processTemplate(
066                            HttpServletRequest request, HttpServletResponse response,
067                            TemplateResource templateResource)
068                    throws Exception {
069    
070                    getRuntimePage().processTemplate(request, response, templateResource);
071            }
072    
073            public static String processXML(
074                            HttpServletRequest request, HttpServletResponse response,
075                            String content)
076                    throws Exception {
077    
078                    return getRuntimePage().processXML(request, response, content);
079            }
080    
081            public static String processXML(
082                            HttpServletRequest request, String content,
083                            RuntimeLogic runtimeLogic)
084                    throws Exception {
085    
086                    return getRuntimePage().processXML(request, content, runtimeLogic);
087            }
088    
089            public void setRuntimePage(RuntimePage runtimePage) {
090                    PortalRuntimePermission.checkSetBeanProperty(getClass());
091    
092                    _runtimePage = runtimePage;
093            }
094    
095            private static RuntimePage _runtimePage;
096    
097    }