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