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