001
014
015 package com.liferay.portlet.layoutconfiguration.util;
016
017 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
018 import com.liferay.portal.kernel.util.StringBundler;
019 import com.liferay.portal.model.Portlet;
020 import com.liferay.portlet.layoutconfiguration.util.xml.RuntimeLogic;
021
022 import javax.portlet.RenderRequest;
023 import javax.portlet.RenderResponse;
024
025 import javax.servlet.ServletContext;
026 import javax.servlet.http.HttpServletRequest;
027 import javax.servlet.http.HttpServletResponse;
028 import javax.servlet.jsp.JspWriter;
029 import javax.servlet.jsp.PageContext;
030
031
036 public class RuntimePortletUtil {
037
038 public static StringBundler getProcessedTemplate(
039 ServletContext servletContext, HttpServletRequest request,
040 HttpServletResponse response, PageContext pageContext,
041 JspWriter jspWriter, String portletId, String velocityTemplateId,
042 String velocityTemplateContent)
043 throws Exception {
044
045 return getRuntimePortlet().getProcessedTemplate(
046 servletContext, request, response, pageContext, jspWriter,
047 portletId, velocityTemplateId, velocityTemplateContent);
048 }
049
050 public static RuntimePortlet getRuntimePortlet() {
051 PortalRuntimePermission.checkGetBeanProperty(RuntimePortletUtil.class);
052
053 return _runtimePortlet;
054 }
055
056 public static String processCustomizationSettings(
057 ServletContext servletContext, HttpServletRequest request,
058 HttpServletResponse response, PageContext pageContext,
059 String velocityTemplateId, String velocityTemplateContent)
060 throws Exception {
061
062 return getRuntimePortlet().processCustomizationSettings(
063 servletContext, request, response, pageContext, velocityTemplateId,
064 velocityTemplateContent);
065 }
066
067 public static String processPortlet(
068 ServletContext servletContext, HttpServletRequest request,
069 HttpServletResponse response, Portlet portlet, String queryString,
070 String columnId, Integer columnPos, Integer columnCount,
071 String path, boolean writeOutput)
072 throws Exception {
073
074 return getRuntimePortlet().processPortlet(
075 servletContext, request, response, portlet, queryString, columnId,
076 columnPos, columnCount, path, writeOutput);
077 }
078
079 public static String processPortlet(
080 ServletContext servletContext, HttpServletRequest request,
081 HttpServletResponse response, RenderRequest renderRequest,
082 RenderResponse renderResponse, Portlet portlet, String portletId,
083 String queryString, String columnId, Integer columnPos,
084 Integer columnCount, String path, boolean writeOutput)
085 throws Exception {
086
087 return getRuntimePortlet().processPortlet(
088 servletContext, request, response, renderRequest, renderResponse,
089 portlet, portletId, queryString, columnId, columnPos, columnCount,
090 path, writeOutput);
091 }
092
093 public static String processPortlet(
094 ServletContext servletContext, HttpServletRequest request,
095 HttpServletResponse response, RenderRequest renderRequest,
096 RenderResponse renderResponse, String portletId, String queryString,
097 boolean writeOutput)
098 throws Exception {
099
100 return getRuntimePortlet().processPortlet(
101 servletContext, request, response, renderRequest, renderResponse,
102 portletId, queryString, writeOutput);
103 }
104
105 public static String processPortlet(
106 ServletContext servletContext, HttpServletRequest request,
107 HttpServletResponse response, RenderRequest renderRequest,
108 RenderResponse renderResponse, String portletId, String queryString,
109 String columnId, Integer columnPos, Integer columnCount,
110 boolean writeOutput)
111 throws Exception {
112
113 return getRuntimePortlet().processPortlet(
114 servletContext, request, response, renderRequest, renderResponse,
115 portletId, queryString, columnId, columnPos, columnCount,
116 writeOutput);
117 }
118
119 public static void processTemplate(
120 ServletContext servletContext, HttpServletRequest request,
121 HttpServletResponse response, PageContext pageContext,
122 JspWriter jspWriter, String velocityTemplateId,
123 String velocityTemplateContent)
124 throws Exception {
125
126 getRuntimePortlet().processTemplate(
127 servletContext, request, response, pageContext, jspWriter,
128 velocityTemplateId, velocityTemplateContent);
129 }
130
131 public static void processTemplate(
132 ServletContext servletContext, HttpServletRequest request,
133 HttpServletResponse response, PageContext pageContext,
134 JspWriter jspWriter, String portletId, String velocityTemplateId,
135 String velocityTemplateContent)
136 throws Exception {
137
138 getRuntimePortlet().processTemplate(
139 servletContext, request, response, pageContext, jspWriter,
140 portletId, velocityTemplateId, velocityTemplateContent);
141 }
142
143 public static String processXML(
144 HttpServletRequest request, String content,
145 RuntimeLogic runtimeLogic)
146 throws Exception {
147
148 return getRuntimePortlet().processXML(request, content, runtimeLogic);
149 }
150
151 public static String processXML(
152 ServletContext servletContext, HttpServletRequest request,
153 HttpServletResponse response, RenderRequest renderRequest,
154 RenderResponse renderResponse, String content)
155 throws Exception {
156
157 return getRuntimePortlet().processXML(
158 servletContext, request, response, renderRequest, renderResponse,
159 content);
160 }
161
162 public void setRuntimePortlet(RuntimePortlet runtimePortlet) {
163 PortalRuntimePermission.checkSetBeanProperty(getClass());
164
165 _runtimePortlet = runtimePortlet;
166 }
167
168 private static RuntimePortlet _runtimePortlet;
169
170 }