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