1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.util;
24  
25  import com.liferay.portal.PortalException;
26  import com.liferay.portal.SystemException;
27  import com.liferay.portal.kernel.upload.UploadPortletRequest;
28  import com.liferay.portal.kernel.upload.UploadServletRequest;
29  import com.liferay.portal.model.Company;
30  import com.liferay.portal.model.Layout;
31  import com.liferay.portal.model.LayoutSet;
32  import com.liferay.portal.model.Portlet;
33  import com.liferay.portal.model.User;
34  import com.liferay.portal.theme.ThemeDisplay;
35  import com.liferay.portlet.expando.model.ExpandoBridge;
36  
37  import java.io.IOException;
38  import java.io.Serializable;
39  
40  import java.util.Date;
41  import java.util.List;
42  import java.util.Locale;
43  import java.util.Map;
44  import java.util.Properties;
45  import java.util.TimeZone;
46  
47  import javax.portlet.ActionRequest;
48  import javax.portlet.ActionResponse;
49  import javax.portlet.PortletMode;
50  import javax.portlet.PortletPreferences;
51  import javax.portlet.PortletRequest;
52  import javax.portlet.PortletResponse;
53  import javax.portlet.PreferencesValidator;
54  import javax.portlet.RenderRequest;
55  import javax.portlet.ValidatorException;
56  import javax.portlet.WindowState;
57  
58  import javax.servlet.ServletContext;
59  import javax.servlet.ServletException;
60  import javax.servlet.http.HttpServletRequest;
61  import javax.servlet.http.HttpServletResponse;
62  import javax.servlet.http.HttpSession;
63  import javax.servlet.jsp.PageContext;
64  
65  /**
66   * <a href="PortalUtil.java.html"><b><i>View Source</i></b></a>
67   *
68   * @author Brian Wing Shun Chan
69   *
70   */
71  public class PortalUtil {
72  
73      public static void clearRequestParameters(RenderRequest renderRequest) {
74          getPortal().clearRequestParameters(renderRequest);
75      }
76  
77      public static void copyRequestParameters(
78          ActionRequest actionRequest, ActionResponse actionResponse) {
79  
80          getPortal().copyRequestParameters(actionRequest, actionResponse);
81      }
82  
83      public static String getCDNHost() {
84          return getPortal().getCDNHost();
85      }
86  
87      public static String getClassName(long classNameId) {
88          return getPortal().getClassName(classNameId);
89      }
90  
91      public static long getClassNameId(Class<?> classObj) {
92          return getPortal().getClassNameId(classObj);
93      }
94  
95      public static long getClassNameId(String value) {
96          return getPortal().getClassNameId(value);
97      }
98  
99      public static String getClassNamePortletId(String className) {
100         return getPortal().getClassNamePortletId(className);
101     }
102 
103     public static String getCommunityLoginURL(ThemeDisplay themeDisplay)
104         throws PortalException, SystemException {
105 
106         return getPortal().getCommunityLoginURL(themeDisplay);
107     }
108 
109     public static Company getCompany(HttpServletRequest request)
110         throws PortalException, SystemException {
111 
112         return getPortal().getCompany(request);
113     }
114 
115     public static Company getCompany(PortletRequest portletRequest)
116         throws PortalException, SystemException {
117 
118         return getPortal().getCompany(portletRequest);
119     }
120 
121     public static long getCompanyId(HttpServletRequest request) {
122         return getPortal().getCompanyId(request);
123     }
124 
125     public static long getCompanyId(PortletRequest portletRequest) {
126         return getPortal().getCompanyId(portletRequest);
127     }
128 
129     public static long[] getCompanyIds() {
130         return getPortal().getCompanyIds();
131     }
132 
133     public static String getComputerAddress() {
134         return getPortal().getComputerAddress();
135     }
136 
137     public static String getComputerName() {
138         return getPortal().getComputerName();
139     }
140 
141     public static String getControlPanelCategory(
142             long companyId, String portletId)
143         throws SystemException {
144 
145         return getPortal().getControlPanelCategory(companyId, portletId);
146     }
147 
148     public static List<Portlet> getControlPanelPortlets(
149             long companyId, String category)
150         throws SystemException {
151 
152         return getPortal().getControlPanelPortlets(companyId, category);
153     }
154 
155     public static String getCurrentURL(HttpServletRequest request) {
156         return getPortal().getCurrentURL(request);
157     }
158 
159     public static String getCurrentURL(PortletRequest portletRequest) {
160         return getPortal().getCurrentURL(portletRequest);
161     }
162 
163     public static String getCustomSQLFunctionIsNotNull() {
164         return getPortal().getCustomSQLFunctionIsNotNull();
165     }
166 
167     public static String getCustomSQLFunctionIsNull() {
168         return getPortal().getCustomSQLFunctionIsNull();
169     }
170 
171     public static Date getDate(int month, int day, int year, PortalException pe)
172         throws PortalException {
173 
174         return getPortal().getDate(month, day, year, pe);
175     }
176 
177     public static Date getDate(
178             int month, int day, int year, TimeZone timeZone, PortalException pe)
179         throws PortalException {
180 
181         return getPortal().getDate(month, day, year, timeZone, pe);
182     }
183 
184     public static Date getDate(
185             int month, int day, int year, int hour, int min, PortalException pe)
186         throws PortalException {
187 
188         return getPortal().getDate(month, day, year, hour, min, pe);
189     }
190 
191     public static Date getDate(
192             int month, int day, int year, int hour, int min, TimeZone timeZone,
193             PortalException pe)
194         throws PortalException {
195 
196         return getPortal().getDate(month, day, year, hour, min, timeZone, pe);
197     }
198 
199     public static long getDefaultCompanyId() {
200         return getPortal().getDefaultCompanyId();
201     }
202 
203     public static Map<String, Serializable> getExpandoBridgeAttributes(
204             ExpandoBridge expandoBridge, PortletRequest portletRequest)
205         throws PortalException, SystemException {
206 
207         return getPortal().getExpandoBridgeAttributes(
208             expandoBridge, portletRequest);
209     }
210 
211     public static String getFirstPageLayoutTypes(PageContext pageContext) {
212         return getPortal().getFirstPageLayoutTypes(pageContext);
213     }
214 
215     public static String getHomeURL(HttpServletRequest request)
216         throws PortalException, SystemException {
217 
218         return getPortal().getHomeURL(request);
219     }
220 
221     public static String getHost(HttpServletRequest request) {
222         return getPortal().getHost(request);
223     }
224 
225     public static String getHost(PortletRequest portletRequest) {
226         return getPortal().getHost(portletRequest);
227     }
228 
229     public static HttpServletRequest getHttpServletRequest(
230         PortletRequest portletRequest) {
231 
232         return getPortal().getHttpServletRequest(portletRequest);
233     }
234 
235     public static HttpServletResponse getHttpServletResponse(
236         PortletResponse portletResponse) {
237 
238         return getPortal().getHttpServletResponse(portletResponse);
239     }
240 
241     public static String getLayoutEditPage(Layout layout) {
242         return getPortal().getLayoutEditPage(layout);
243     }
244 
245     public static String getLayoutViewPage(Layout layout) {
246         return getPortal().getLayoutViewPage(layout);
247     }
248 
249     public static String getLayoutURL(ThemeDisplay themeDisplay) {
250         return getPortal().getLayoutURL(themeDisplay);
251     }
252 
253     public static String getLayoutURL(
254         Layout layout, ThemeDisplay themeDisplay) {
255 
256         return getPortal().getLayoutURL(layout, themeDisplay);
257     }
258 
259     public static String getLayoutURL(
260         Layout layout, ThemeDisplay themeDisplay, boolean doAsUser) {
261 
262         return getPortal().getLayoutURL(layout, themeDisplay, doAsUser);
263     }
264 
265     public static String getLayoutActualURL(Layout layout) {
266         return getPortal().getLayoutActualURL(layout);
267     }
268 
269     public static String getLayoutActualURL(Layout layout, String mainPath) {
270         return getPortal().getLayoutActualURL(layout, mainPath);
271     }
272 
273     public static String getLayoutActualURL(
274             long groupId, boolean privateLayout, String mainPath,
275             String friendlyURL)
276         throws PortalException, SystemException {
277 
278         return getPortal().getLayoutActualURL(
279             groupId, privateLayout, mainPath, friendlyURL);
280     }
281 
282     public static String getLayoutActualURL(
283             long groupId, boolean privateLayout, String mainPath,
284             String friendlyURL, Map<String, String[]> params)
285         throws PortalException, SystemException {
286 
287         return getPortal().getLayoutActualURL(
288             groupId, privateLayout, mainPath, friendlyURL, params);
289     }
290 
291     public static String getLayoutFriendlyURL(
292         Layout layout, ThemeDisplay themeDisplay) {
293 
294         return getPortal().getLayoutFriendlyURL(layout, themeDisplay);
295     }
296 
297     public static String getLayoutSetFriendlyURL(
298             LayoutSet layoutSet, ThemeDisplay themeDisplay)
299         throws PortalException, SystemException {
300 
301         return getPortal().getLayoutSetFriendlyURL(layoutSet, themeDisplay);
302     }
303 
304     public static String getLayoutTarget(Layout layout) {
305         return getPortal().getLayoutTarget(layout);
306     }
307 
308     public static String getJsSafePortletId(String portletId) {
309         return getPortal().getJsSafePortletId(portletId);
310     }
311 
312     public static Locale getLocale(HttpServletRequest request) {
313         return getPortal().getLocale(request);
314     }
315 
316     public static Locale getLocale(RenderRequest renderRequest) {
317         return getPortal().getLocale(renderRequest);
318     }
319 
320     public static HttpServletRequest getOriginalServletRequest(
321         HttpServletRequest request) {
322 
323         return getPortal().getOriginalServletRequest(request);
324     }
325 
326     public static String getPathContext() {
327         return getPortal().getPathContext();
328     }
329 
330     public static String getPathFriendlyURLPrivateGroup() {
331         return getPortal().getPathFriendlyURLPrivateGroup();
332     }
333 
334     public static String getPathFriendlyURLPrivateUser() {
335         return getPortal().getPathFriendlyURLPrivateUser();
336     }
337 
338     public static String getPathFriendlyURLPublic() {
339         return getPortal().getPathFriendlyURLPublic();
340     }
341 
342     public static String getPathImage() {
343         return getPortal().getPathImage();
344     }
345 
346     public static String getPathMain() {
347         return getPortal().getPathMain();
348     }
349 
350     public static long getPlidFromFriendlyURL(
351         long companyId, String friendlyURL) {
352 
353         return getPortal().getPlidFromFriendlyURL(companyId, friendlyURL);
354     }
355 
356     public static long getPlidFromPortletId(
357         long groupId, boolean privateLayout, String portletId) {
358 
359         return getPortal().getPlidFromPortletId(
360             groupId, privateLayout, portletId);
361     }
362 
363     public static Portal getPortal() {
364         return _portal;
365     }
366 
367     public static String getPortalLibDir() {
368         return getPortal().getPortalLibDir();
369     }
370 
371     public static int getPortalPort() {
372         return getPortal().getPortalPort();
373     }
374 
375     public static Properties getPortalProperties() {
376         return getPortal().getPortalProperties();
377     }
378 
379     public static String getPortalURL(ThemeDisplay themeDisplay) {
380         return getPortal().getPortalURL(themeDisplay);
381     }
382 
383     public static String getPortalURL(HttpServletRequest request) {
384         return getPortal().getPortalURL(request);
385     }
386 
387     public static String getPortalURL(
388         HttpServletRequest request, boolean secure) {
389 
390         return getPortal().getPortalURL(request, secure);
391     }
392 
393     public static String getPortalURL(PortletRequest portletRequest) {
394         return getPortal().getPortalURL(portletRequest);
395     }
396 
397     public static String getPortalURL(
398         PortletRequest portletRequest, boolean secure) {
399 
400         return getPortal().getPortalURL(portletRequest, secure);
401     }
402 
403     public static String getPortalURL(
404         String serverName, int serverPort, boolean secure) {
405 
406         return getPortal().getPortalURL(serverName, serverPort, secure);
407     }
408 
409     public static String getPortalWebDir() {
410         return getPortal().getPortalWebDir();
411     }
412 
413     public static Object[] getPortletFriendlyURLMapper(
414             long groupId, boolean privateLayout, String url)
415         throws PortalException, SystemException {
416 
417         return getPortal().getPortletFriendlyURLMapper(
418             groupId, privateLayout, url);
419     }
420 
421     public static Object[] getPortletFriendlyURLMapper(
422             long groupId, boolean privateLayout, String url,
423             Map<String, String[]> params)
424         throws PortalException, SystemException {
425 
426         return getPortal().getPortletFriendlyURLMapper(
427             groupId, privateLayout, url, params);
428     }
429 
430     /**
431      * @deprecated Use <code>getScopeGroupId</code>.
432      */
433     public static long getPortletGroupId(long plid) {
434         return getPortal().getPortletGroupId(plid);
435     }
436 
437     /**
438      * @deprecated Use <code>getScopeGroupId</code>.
439      */
440     public static long getPortletGroupId(Layout layout) {
441         return getPortal().getPortletGroupId(layout);
442     }
443 
444     /**
445      * @deprecated Use <code>getScopeGroupId</code>.
446      */
447     public static long getPortletGroupId(HttpServletRequest request) {
448         return getPortal().getPortletGroupId(request);
449     }
450 
451     /**
452      * @deprecated Use <code>getScopeGroupId</code>.
453      */
454     public static long getPortletGroupId(ActionRequest actionRequest) {
455         return getPortal().getPortletGroupId(actionRequest);
456     }
457 
458     /**
459      * @deprecated Use <code>getScopeGroupId</code>.
460      */
461     public static long getPortletGroupId(RenderRequest renderRequest) {
462         return getPortal().getPortletGroupId(renderRequest);
463     }
464 
465     public static String getPortletId(HttpServletRequest request) {
466         return getPortal().getPortletId(request);
467     }
468 
469     public static String getPortletId(PortletRequest portletRequest) {
470         return getPortal().getPortletId(portletRequest);
471     }
472 
473     public static String getPortletNamespace(String portletId) {
474         return getPortal().getPortletNamespace(portletId);
475     }
476 
477     public static String getPortletTitle(
478         String portletId, long companyId, String languageId) {
479 
480         return getPortal().getPortletTitle(portletId, companyId, languageId);
481     }
482 
483     public static String getPortletTitle(
484         String portletId, long companyId, Locale locale) {
485 
486         return getPortal().getPortletTitle(portletId, companyId, locale);
487     }
488 
489     public static String getPortletTitle(String portletId, User user) {
490         return getPortal().getPortletTitle(portletId, user);
491     }
492 
493     public static String getPortletTitle(
494         Portlet portlet, long companyId, String languageId) {
495 
496         return getPortletTitle(portlet, companyId, languageId);
497     }
498 
499     public static String getPortletTitle(
500         Portlet portlet, long companyId, Locale locale) {
501 
502         return getPortal().getPortletTitle(portlet, companyId, locale);
503     }
504 
505     public static String getPortletTitle(Portlet portlet, User user) {
506         return getPortal().getPortletTitle(portlet, user);
507     }
508 
509     public static String getPortletTitle(
510         Portlet portlet, ServletContext servletContext, Locale locale) {
511 
512         return getPortal().getPortletTitle(portlet, servletContext, locale);
513     }
514 
515     public static String getPortletXmlFileName() throws SystemException {
516         return getPortal().getPortletXmlFileName();
517     }
518 
519     public static PortletPreferences getPreferences(
520         HttpServletRequest request) {
521 
522         return getPortal().getPreferences(request);
523     }
524 
525     public static PreferencesValidator getPreferencesValidator(
526         Portlet portlet) {
527 
528         return getPortal().getPreferencesValidator(portlet);
529     }
530 
531     public static long getScopeGroupId(long plid) {
532         return getPortal().getScopeGroupId(plid);
533     }
534 
535     public static long getScopeGroupId(Layout layout) {
536         return getPortal().getScopeGroupId(layout);
537     }
538 
539     public static long getScopeGroupId(Layout layout, String portletId) {
540         return getPortal().getScopeGroupId(layout, portletId);
541     }
542 
543     public static long getScopeGroupId(HttpServletRequest request) {
544         return getPortal().getScopeGroupId(request);
545     }
546 
547     public static long getScopeGroupId(
548         HttpServletRequest request, String portletId) {
549 
550         return getPortal().getScopeGroupId(request, portletId);
551     }
552 
553     public static long getScopeGroupId(PortletRequest portletRequest) {
554         return getPortal().getScopeGroupId(portletRequest);
555     }
556 
557     public static User getSelectedUser(HttpServletRequest request)
558         throws PortalException, SystemException {
559 
560         return getPortal().getSelectedUser(request);
561     }
562 
563     public static User getSelectedUser(
564             HttpServletRequest request, boolean checkPermission)
565         throws PortalException, SystemException {
566 
567         return getPortal().getSelectedUser(request, checkPermission);
568     }
569 
570     public static User getSelectedUser(PortletRequest portletRequest)
571         throws PortalException, SystemException {
572 
573         return getPortal().getSelectedUser(portletRequest);
574     }
575 
576     public static User getSelectedUser(
577             PortletRequest portletRequest, boolean checkPermission)
578         throws PortalException, SystemException {
579 
580         return getPortal().getSelectedUser(portletRequest, checkPermission);
581     }
582 
583     public static String getStaticResourceURL(
584         HttpServletRequest request, String uri) {
585 
586         return getPortal().getStaticResourceURL(request, uri);
587     }
588 
589     public static String getStaticResourceURL(
590         HttpServletRequest request, String uri, String queryString) {
591 
592         return getPortal().getStaticResourceURL(request, uri, queryString);
593     }
594 
595     public static String getStaticResourceURL(
596         HttpServletRequest request, String uri, long timestamp) {
597 
598         return getPortal().getStaticResourceURL(request, uri, timestamp);
599     }
600 
601     public static String getStaticResourceURL(
602         HttpServletRequest request, String uri, String queryString,
603         long timestamp) {
604 
605         return getPortal().getStaticResourceURL(
606             request, uri, queryString, timestamp);
607     }
608 
609     public static String getStrutsAction(HttpServletRequest request) {
610         return getPortal().getStrutsAction(request);
611     }
612 
613     public static String[] getSystemCommunityRoles() {
614         return getPortal().getSystemCommunityRoles();
615     }
616 
617     public static String[] getSystemGroups() {
618         return getPortal().getSystemGroups();
619     }
620 
621     public static String[] getSystemOrganizationRoles() {
622         return getPortal().getSystemOrganizationRoles();
623     }
624 
625     public static String[] getSystemRoles() {
626         return getPortal().getSystemRoles();
627     }
628 
629     public static String[] getTagsCategories(PortletRequest portletRequest) {
630         return getPortal().getTagsCategories(portletRequest);
631     }
632 
633     public static String[] getTagsEntries(PortletRequest portletRequest) {
634         return getPortal().getTagsEntries(portletRequest);
635     }
636 
637     public static UploadPortletRequest getUploadPortletRequest(
638         ActionRequest actionRequest) {
639 
640         return getPortal().getUploadPortletRequest(actionRequest);
641     }
642 
643     public static UploadServletRequest getUploadServletRequest(
644         HttpServletRequest request) {
645 
646         return getPortal().getUploadServletRequest(request);
647     }
648 
649     public static Date getUptime() {
650         return getPortal().getUptime();
651     }
652 
653     public static String getURLWithSessionId(String url, String sessionId) {
654         return getPortal().getURLWithSessionId(url, sessionId);
655     }
656 
657     public static User getUser(HttpServletRequest request)
658         throws PortalException, SystemException {
659 
660         return getPortal().getUser(request);
661     }
662 
663     public static User getUser(PortletRequest portletRequest)
664         throws PortalException, SystemException {
665 
666         return getPortal().getUser(portletRequest);
667     }
668 
669     public static long getUserId(HttpServletRequest request) {
670         return getPortal().getUserId(request);
671     }
672 
673     public static long getUserId(PortletRequest portletRequest) {
674         return getPortal().getUserId(portletRequest);
675     }
676 
677     public static String getUserName(long userId, String defaultUserName) {
678         return getPortal().getUserName(userId, defaultUserName);
679     }
680 
681     public static String getUserName(
682         long userId, String defaultUserName, String userAttribute) {
683 
684         return getPortal().getUserName(userId, defaultUserName, userAttribute);
685     }
686 
687     public static String getUserName(
688         long userId, String defaultUserName, HttpServletRequest request) {
689 
690         return getPortal().getUserName(userId, defaultUserName, request);
691     }
692 
693     public static String getUserName(
694         long userId, String defaultUserName, String userAttribute,
695         HttpServletRequest request) {
696 
697         return getPortal().getUserName(
698             userId, defaultUserName, userAttribute, request);
699     }
700 
701     public static String getUserPassword(HttpSession session) {
702         return getPortal().getUserPassword(session);
703     }
704 
705     public static String getUserPassword(HttpServletRequest request) {
706         return getPortal().getUserPassword(request);
707     }
708 
709     public static String getUserPassword(PortletRequest portletRequest) {
710         return getPortal().getUserPassword(portletRequest);
711     }
712 
713     public static String getUserValue(
714             long userId, String param, String defaultValue)
715         throws SystemException {
716 
717         return getPortal().getUserValue(userId, param, defaultValue);
718     }
719 
720     public static String getWidgetURL(
721         Portlet portlet, ThemeDisplay themeDisplay) {
722 
723         return getPortal().getWidgetURL(portlet, themeDisplay);
724     }
725 
726     public static boolean isLayoutFirstPageable(String type) {
727         return getPortal().isLayoutFirstPageable(type);
728     }
729 
730     public static boolean isLayoutFriendliable(Layout layout) {
731         return getPortal().isLayoutFriendliable(layout);
732     }
733 
734     public static boolean isLayoutParentable(Layout layout) {
735         return getPortal().isLayoutParentable(layout);
736     }
737 
738     public static boolean isLayoutParentable(String type) {
739         return getPortal().isLayoutParentable(type);
740     }
741 
742     public static boolean isLayoutSitemapable(Layout layout) {
743         return getPortal().isLayoutSitemapable(layout);
744     }
745 
746     public static boolean isMethodGet(PortletRequest portletRequest) {
747         return getPortal().isMethodGet(portletRequest);
748     }
749 
750     public static boolean isMethodPost(PortletRequest portletRequest) {
751         return getPortal().isMethodPost(portletRequest);
752     }
753 
754     public static boolean isReservedParameter(String name) {
755         return getPortal().isReservedParameter(name);
756     }
757 
758     public static boolean isSystemGroup(String groupName) {
759         return getPortal().isSystemGroup(groupName);
760     }
761 
762     public static boolean isSystemRole(String roleName) {
763         return getPortal().isSystemRole(roleName);
764     }
765 
766     public static boolean isUpdateAvailable()
767         throws PortalException, SystemException {
768 
769         return getPortal().isUpdateAvailable();
770     }
771 
772     public static void renderPage(
773             StringBuilder sb, ServletContext servletContext,
774             HttpServletRequest request, HttpServletResponse response,
775             String path)
776         throws IOException, ServletException {
777 
778         getPortal().renderPage(sb, servletContext, request, response, path);
779     }
780 
781     public static void renderPortlet(
782             StringBuilder sb, ServletContext servletContext,
783             HttpServletRequest request, HttpServletResponse response,
784             Portlet portlet, String queryString)
785         throws IOException, ServletException {
786 
787         getPortal().renderPortlet(
788             sb, servletContext, request, response, portlet, queryString);
789     }
790 
791     public static void renderPortlet(
792             StringBuilder sb, ServletContext servletContext,
793             HttpServletRequest request, HttpServletResponse response,
794             Portlet portlet, String queryString, String columnId,
795             Integer columnPos, Integer columnCount)
796         throws IOException, ServletException {
797 
798         getPortal().renderPortlet(
799             sb, servletContext, request, response, portlet, queryString,
800             columnId, columnPos, columnCount);
801     }
802 
803     public static void renderPortlet(
804             StringBuilder sb, ServletContext servletContext,
805             HttpServletRequest request, HttpServletResponse response,
806             Portlet portlet, String queryString, String columnId,
807             Integer columnPos, Integer columnCount, String path)
808         throws IOException, ServletException {
809 
810         getPortal().renderPortlet(
811             sb, servletContext, request, response, portlet, queryString,
812             columnId, columnPos, columnCount, path);
813     }
814 
815     public static void sendError(
816             Exception e, HttpServletRequest request,
817             HttpServletResponse response)
818         throws IOException, ServletException {
819 
820         getPortal().sendError(e, request, response);
821     }
822 
823     public static void sendError(
824             int status, Exception e, HttpServletRequest request,
825             HttpServletResponse response)
826         throws IOException, ServletException {
827 
828         getPortal().sendError(status, e, request, response);
829     }
830 
831     public static void sendError(
832             Exception e, ActionRequest actionRequest,
833             ActionResponse actionResponse)
834         throws IOException {
835 
836         getPortal().sendError(e, actionRequest, actionResponse);
837     }
838 
839     public static void sendError(
840             int status, Exception e, ActionRequest actionRequest,
841             ActionResponse actionResponse)
842         throws IOException {
843 
844         getPortal().sendError(status, e, actionRequest, actionResponse);
845     }
846 
847     /**
848      * Sets the subtitle for a page. This is just a hint and can be overridden
849      * by subsequent calls. The last call to this method wins.
850      *
851      * @param       subtitle the subtitle for a page
852      * @param       req the HTTP servlet request
853      */
854     public static void setPageSubtitle(
855         String subtitle, HttpServletRequest request) {
856 
857         getPortal().setPageSubtitle(subtitle, request);
858     }
859 
860     /**
861      * Sets the whole title for a page. This is just a hint and can be
862      * overridden by subsequent calls. The last call to this method wins.
863      *
864      * @param       title the whole title for a page
865      * @param       req the HTTP servlet request
866      */
867     public static void setPageTitle(String title, HttpServletRequest request) {
868         getPortal().setPageTitle(title, request);
869     }
870 
871     /**
872      * Sets the port obtained on the first request to the portal.
873      *
874      * @param       req the HTTP servlet request
875      */
876     public static void setPortalPort(HttpServletRequest request) {
877         getPortal().setPortalPort(request);
878     }
879 
880     public static void storePreferences(PortletPreferences preferences)
881         throws IOException, ValidatorException {
882 
883         getPortal().storePreferences(preferences);
884     }
885 
886     public static String transformCustomSQL(String sql) {
887         return getPortal().transformCustomSQL(sql);
888     }
889 
890     public static PortletMode updatePortletMode(
891         String portletId, User user, Layout layout, PortletMode portletMode,
892         HttpServletRequest request) {
893 
894         return getPortal().updatePortletMode(
895             portletId, user, layout, portletMode, request);
896     }
897 
898     public static WindowState updateWindowState(
899         String portletId, User user, Layout layout, WindowState windowState,
900         HttpServletRequest request) {
901 
902         return getPortal().updateWindowState(
903             portletId, user, layout, windowState, request);
904     }
905 
906     public void setPortal(Portal portal) {
907         _portal = portal;
908     }
909 
910     private static Portal _portal;
911 
912 }