001
014
015 package com.liferay.taglib.util;
016
017 import com.liferay.portal.kernel.language.LanguageUtil;
018 import com.liferay.portal.kernel.portlet.PortletProvider;
019 import com.liferay.portal.kernel.servlet.DirectRequestDispatcherFactoryUtil;
020 import com.liferay.portal.kernel.servlet.JSPSupportServlet;
021 import com.liferay.portal.kernel.servlet.taglib.ui.Menu;
022 import com.liferay.portal.kernel.template.TemplateConstants;
023 import com.liferay.portal.kernel.util.HttpUtil;
024 import com.liferay.portal.kernel.util.StringPool;
025 import com.liferay.portal.kernel.util.WebKeys;
026 import com.liferay.portal.model.Layout;
027 import com.liferay.portal.model.LayoutConstants;
028 import com.liferay.portal.model.Portlet;
029 import com.liferay.portal.theme.ThemeDisplay;
030 import com.liferay.taglib.TagSupport;
031 import com.liferay.taglib.aui.ColumnTag;
032 import com.liferay.taglib.aui.LayoutTag;
033 import com.liferay.taglib.portlet.ActionURLTag;
034 import com.liferay.taglib.portletext.IconBackTag;
035 import com.liferay.taglib.portletext.IconOptionsTag;
036 import com.liferay.taglib.portletext.IconPortletTag;
037 import com.liferay.taglib.portletext.RuntimeTag;
038 import com.liferay.taglib.security.DoAsURLTag;
039 import com.liferay.taglib.security.PermissionsURLTag;
040 import com.liferay.taglib.servlet.PipingPageContext;
041 import com.liferay.taglib.theme.LayoutIconTag;
042 import com.liferay.taglib.theme.MetaTagsTag;
043 import com.liferay.taglib.theme.WrapPortletTag;
044 import com.liferay.taglib.ui.AssetCategoriesSummaryTag;
045 import com.liferay.taglib.ui.AssetLinksTag;
046 import com.liferay.taglib.ui.AssetTagsSummaryTag;
047 import com.liferay.taglib.ui.BreadcrumbTag;
048 import com.liferay.taglib.ui.DiscussionTag;
049 import com.liferay.taglib.ui.FlagsTag;
050 import com.liferay.taglib.ui.IconTag;
051 import com.liferay.taglib.ui.JournalArticleTag;
052 import com.liferay.taglib.ui.JournalContentSearchTag;
053 import com.liferay.taglib.ui.LanguageTag;
054 import com.liferay.taglib.ui.MenuTag;
055 import com.liferay.taglib.ui.MySitesTag;
056 import com.liferay.taglib.ui.PngImageTag;
057 import com.liferay.taglib.ui.QuickAccessTag;
058 import com.liferay.taglib.ui.RatingsTag;
059 import com.liferay.taglib.ui.SearchTag;
060 import com.liferay.taglib.ui.SitesDirectoryTag;
061 import com.liferay.taglib.ui.SocialBookmarksTag;
062 import com.liferay.taglib.ui.ToggleTag;
063
064 import java.io.Writer;
065
066 import java.util.Map;
067 import java.util.Set;
068
069 import javax.portlet.PortletMode;
070 import javax.portlet.PortletRequest;
071 import javax.portlet.PortletURL;
072 import javax.portlet.WindowState;
073
074 import javax.servlet.RequestDispatcher;
075 import javax.servlet.ServletContext;
076 import javax.servlet.http.HttpServletRequest;
077 import javax.servlet.http.HttpServletResponse;
078 import javax.servlet.jsp.JspFactory;
079 import javax.servlet.jsp.PageContext;
080
081
085 public class VelocityTaglibImpl implements VelocityTaglib {
086
087 public VelocityTaglibImpl(
088 ServletContext servletContext, HttpServletRequest request,
089 HttpServletResponse response, Map<String, Object> contextObjects) {
090
091 _servletContext = servletContext;
092 _request = request;
093 _response = response;
094 _contextObjects = contextObjects;
095
096 JspFactory jspFactory = JspFactory.getDefaultFactory();
097
098 _pageContext = jspFactory.getPageContext(
099 new JSPSupportServlet(_servletContext), _request, _response, null,
100 false, 0, false);
101 }
102
103 @Override
104 public String actionURL(long plid, String portletName, String queryString)
105 throws Exception {
106
107 String windowState = WindowState.NORMAL.toString();
108 String portletMode = PortletMode.VIEW.toString();
109
110 return actionURL(
111 windowState, portletMode, plid, portletName, queryString);
112 }
113
114 @Override
115 public String actionURL(String portletName, String queryString)
116 throws Exception {
117
118 return actionURL(
119 LayoutConstants.DEFAULT_PLID, portletName, queryString);
120 }
121
122
127 @Deprecated
128 @Override
129 public String actionURL(
130 String windowState, String portletMode, Boolean secure,
131 Boolean copyCurrentRenderParameters, Boolean escapeXml, String name,
132 long plid, long refererPlid, String portletName, Boolean anchor,
133 Boolean encrypt, long doAsUserId, Boolean portletConfiguration,
134 String queryString)
135 throws Exception {
136
137 return actionURL(
138 windowState, portletMode, secure, copyCurrentRenderParameters,
139 escapeXml, name, plid, refererPlid, portletName, anchor, encrypt, 0,
140 doAsUserId, portletConfiguration, queryString);
141 }
142
143 @Override
144 public String actionURL(
145 String windowState, String portletMode, Boolean secure,
146 Boolean copyCurrentRenderParameters, Boolean escapeXml, String name,
147 long plid, long refererPlid, String portletName, Boolean anchor,
148 Boolean encrypt, long doAsGroupId, long doAsUserId,
149 Boolean portletConfiguration, String queryString)
150 throws Exception {
151
152 String resourceID = null;
153 String cacheability = null;
154 Map<String, String[]> parameterMap = HttpUtil.parameterMapFromString(
155 queryString);
156 Set<String> removedParameterNames = null;
157
158 PortletURL portletURL = ActionURLTag.doTag(
159 PortletRequest.ACTION_PHASE, windowState, portletMode, secure,
160 copyCurrentRenderParameters, escapeXml, name, resourceID,
161 cacheability, plid, refererPlid, portletName, anchor, encrypt,
162 doAsGroupId, doAsUserId, portletConfiguration, parameterMap,
163 removedParameterNames, _request);
164
165 return portletURL.toString();
166 }
167
168 @Override
169 public String actionURL(
170 String windowState, String portletMode, long plid,
171 String portletName, String queryString)
172 throws Exception {
173
174 Boolean secure = null;
175 Boolean copyCurrentRenderParameters = null;
176 Boolean escapeXml = null;
177 long refererPlid = LayoutConstants.DEFAULT_PLID;
178 String name = null;
179 Boolean anchor = null;
180 Boolean encrypt = null;
181 long doAsGroupId = 0;
182 long doAsUserId = 0;
183 Boolean portletConfiguration = null;
184
185 return actionURL(
186 windowState, portletMode, secure, copyCurrentRenderParameters,
187 escapeXml, name, plid, refererPlid, portletName, anchor, encrypt,
188 doAsGroupId, doAsUserId, portletConfiguration, queryString);
189 }
190
191 @Override
192 public String actionURL(
193 String windowState, String portletMode, String portletName,
194 String queryString)
195 throws Exception {
196
197 return actionURL(
198 windowState, portletMode, LayoutConstants.DEFAULT_PLID, portletName,
199 queryString);
200 }
201
202 @Override
203 public void assetCategoriesSummary(
204 String className, long classPK, String message,
205 PortletURL portletURL)
206 throws Exception {
207
208 AssetCategoriesSummaryTag<?> assetCategorySummaryTag =
209 new AssetCategoriesSummaryTag<>();
210
211 setUp(assetCategorySummaryTag);
212
213 assetCategorySummaryTag.setClassName(className);
214 assetCategorySummaryTag.setClassPK(classPK);
215 assetCategorySummaryTag.setMessage(message);
216 assetCategorySummaryTag.setPortletURL(portletURL);
217
218 assetCategorySummaryTag.runTag();
219 }
220
221 @Override
222 public void assetLinks(long assetEntryId, String className, long classPK)
223 throws Exception {
224
225 AssetLinksTag assetLinksTag = new AssetLinksTag();
226
227 setUp(assetLinksTag);
228
229 assetLinksTag.setAssetEntryId(assetEntryId);
230 assetLinksTag.setClassName(className);
231 assetLinksTag.setClassPK(classPK);
232
233 assetLinksTag.runTag();
234 }
235
236 @Override
237 public void assetTagsSummary(
238 String className, long classPK, String message,
239 String assetTagNames, PortletURL portletURL)
240 throws Exception {
241
242 AssetTagsSummaryTag<?> assetTagsSummaryTag =
243 new AssetTagsSummaryTag<>();
244
245 setUp(assetTagsSummaryTag);
246
247 assetTagsSummaryTag.setClassName(className);
248 assetTagsSummaryTag.setClassPK(classPK);
249 assetTagsSummaryTag.setMessage(message);
250 assetTagsSummaryTag.setPortletURL(portletURL);
251 assetTagsSummaryTag.setAssetTagNames(assetTagNames);
252
253 assetTagsSummaryTag.runTag();
254 }
255
256 @Override
257 public void breadcrumb() throws Exception {
258 BreadcrumbTag breadcrumbTag = new BreadcrumbTag();
259
260 setUp(breadcrumbTag);
261
262 breadcrumbTag.runTag();
263 }
264
265 @Override
266 public void breadcrumb(
267 long ddmTemplateGroupId, String ddmTemplateKey,
268 boolean showGuestGroup, boolean showParentGroups,
269 boolean showLayout, boolean showPortletBreadcrumb)
270 throws Exception {
271
272 BreadcrumbTag breadcrumbTag = new BreadcrumbTag();
273
274 setUp(breadcrumbTag);
275
276 breadcrumbTag.setDdmTemplateGroupId(ddmTemplateGroupId);
277 breadcrumbTag.setDdmTemplateKey(ddmTemplateKey);
278 breadcrumbTag.setShowGuestGroup(showGuestGroup);
279 breadcrumbTag.setShowLayout(showLayout);
280 breadcrumbTag.setShowParentGroups(showParentGroups);
281 breadcrumbTag.setShowPortletBreadcrumb(showPortletBreadcrumb);
282
283 breadcrumbTag.runTag();
284 }
285
286 @Override
287 public void discussion(
288 String className, long classPK, String formAction, String formName,
289 boolean hideControls, boolean ratingsEnabled, String redirect,
290 long userId)
291 throws Exception {
292
293 DiscussionTag discussionTag = new DiscussionTag();
294
295 setUp(discussionTag);
296
297 discussionTag.setClassName(className);
298 discussionTag.setClassPK(classPK);
299 discussionTag.setFormAction(formAction);
300 discussionTag.setFormName(formName);
301 discussionTag.setHideControls(hideControls);
302 discussionTag.setRatingsEnabled(ratingsEnabled);
303 discussionTag.setRedirect(redirect);
304 discussionTag.setUserId(userId);
305
306 discussionTag.runTag();
307 }
308
309
313 @Deprecated
314 @Override
315 public void discussion(
316 String className, long classPK, String formAction, String formName,
317 boolean hideControls, boolean ratingsEnabled, String redirect,
318 String subject, long userId)
319 throws Exception {
320
321 discussion(
322 className, classPK, formAction, formName, hideControls,
323 ratingsEnabled, redirect, userId);
324 }
325
326 @Override
327 public void doAsURL(long doAsUserId) throws Exception {
328 DoAsURLTag.doTag(doAsUserId, _request);
329 }
330
331 @Override
332 public void flags(
333 String className, long classPK, String contentTitle, boolean label,
334 String message, long reportedUserId)
335 throws Exception {
336
337 FlagsTag flagsTag = new FlagsTag();
338
339 setUp(flagsTag);
340
341 flagsTag.setClassName(className);
342 flagsTag.setClassPK(classPK);
343 flagsTag.setContentTitle(contentTitle);
344 flagsTag.setLabel(label);
345 flagsTag.setMessage(message);
346 flagsTag.setReportedUserId(reportedUserId);
347
348 flagsTag.runTag();
349 }
350
351 @Override
352 public AssetCategoriesSummaryTag<?> getAssetCategoriesSummaryTag()
353 throws Exception {
354
355 AssetCategoriesSummaryTag<?> assetCategoriesSummaryTag =
356 new AssetCategoriesSummaryTag<>();
357
358 setUp(assetCategoriesSummaryTag);
359
360 return assetCategoriesSummaryTag;
361 }
362
363 @Override
364 public AssetLinksTag getAssetLinksTag() throws Exception {
365 AssetLinksTag assetLinksTag = new AssetLinksTag();
366
367 setUp(assetLinksTag);
368
369 return assetLinksTag;
370 }
371
372 @Override
373 public AssetTagsSummaryTag<?> getAssetTagsSummaryTag() throws Exception {
374 AssetTagsSummaryTag<?> assetTagsSummaryTag =
375 new AssetTagsSummaryTag<>();
376
377 setUp(assetTagsSummaryTag);
378
379 return assetTagsSummaryTag;
380 }
381
382 @Override
383 public BreadcrumbTag getBreadcrumbTag() throws Exception {
384 BreadcrumbTag breadcrumbTag = new BreadcrumbTag();
385
386 setUp(breadcrumbTag);
387
388 return breadcrumbTag;
389 }
390
391 @Override
392 public ColumnTag getColumnTag() throws Exception {
393 ColumnTag columnTag = new ColumnTag();
394
395 setUp(columnTag);
396
397 return columnTag;
398 }
399
400 @Override
401 public DiscussionTag getDiscussionTag() throws Exception {
402 DiscussionTag discussionTag = new DiscussionTag();
403
404 setUp(discussionTag);
405
406 return discussionTag;
407 }
408
409 @Override
410 public FlagsTag getFlagsTag() throws Exception {
411 FlagsTag flagsTag = new FlagsTag();
412
413 setUp(flagsTag);
414
415 return flagsTag;
416 }
417
418 @Override
419 public IconTag getIconTag() throws Exception {
420 IconTag iconTag = new IconTag();
421
422 setUp(iconTag);
423
424 return iconTag;
425 }
426
427 @Override
428 public JournalArticleTag getJournalArticleTag() throws Exception {
429 JournalArticleTag journalArticleTag = new JournalArticleTag();
430
431 setUp(journalArticleTag);
432
433 return journalArticleTag;
434 }
435
436 @Override
437 public LayoutTag getLayoutTag() throws Exception {
438 LayoutTag layoutTag = new LayoutTag();
439
440 setUp(layoutTag);
441
442 return layoutTag;
443 }
444
445 @Override
446 public MenuTag getMenuTag() throws Exception {
447 MenuTag menuTag = new MenuTag();
448
449 setUp(menuTag);
450
451 return menuTag;
452 }
453
454 @Override
455 public MySitesTag getMySitesTag() throws Exception {
456 MySitesTag mySitesTag = new MySitesTag();
457
458 setUp(mySitesTag);
459
460 return mySitesTag;
461 }
462
463 @Override
464 public PageContext getPageContext() {
465 return _pageContext;
466 }
467
468 @Override
469 public PngImageTag getPngImageTag() throws Exception {
470 PngImageTag pngImageTag = new PngImageTag();
471
472 setUp(pngImageTag);
473
474 return pngImageTag;
475 }
476
477 @Override
478 public QuickAccessTag getQuickAccessTag() throws Exception {
479 QuickAccessTag quickAccessTag = new QuickAccessTag();
480
481 setUp(quickAccessTag);
482
483 return quickAccessTag;
484 }
485
486 @Override
487 public RatingsTag getRatingsTag() throws Exception {
488 RatingsTag ratingsTag = new RatingsTag();
489
490 setUp(ratingsTag);
491
492 return ratingsTag;
493 }
494
495 @Override
496 public String getSetting(String name) {
497 ThemeDisplay themeDisplay = (ThemeDisplay)_request.getAttribute(
498 WebKeys.THEME_DISPLAY);
499
500 return themeDisplay.getThemeSetting(name);
501 }
502
503 @Override
504 public WindowState getWindowState(String windowState) {
505 return new WindowState(windowState);
506 }
507
508 @Override
509 public void icon(String image, boolean label, String message, String url)
510 throws Exception {
511
512 IconTag iconTag = new IconTag();
513
514 setUp(iconTag);
515
516 iconTag.setImage(image);
517 iconTag.setLabel(label);
518 iconTag.setMessage(message);
519 iconTag.setUrl(url);
520
521 iconTag.runTag();
522 }
523
524
527 @Deprecated
528 @Override
529 public void iconBack() throws Exception {
530 portletIconBack();
531 }
532
533 @Override
534 public void iconHelp(String message) throws Exception {
535 com.liferay.taglib.ui.IconHelpTag iconHelpTag =
536 new com.liferay.taglib.ui.IconHelpTag();
537
538 setUp(iconHelpTag);
539
540 iconHelpTag.setMessage(message);
541
542 iconHelpTag.runTag();
543 }
544
545
548 @Deprecated
549 @Override
550 public void iconOptions() throws Exception {
551 portletIconOptions();
552 }
553
554
557 @Deprecated
558 @Override
559 public void iconPortlet() throws Exception {
560 portletIconPortlet();
561 }
562
563
566 @Deprecated
567 @Override
568 public void iconPortlet(Portlet portlet) throws Exception {
569 portletIconPortlet();
570 }
571
572 @Override
573 public void include(ServletContext servletContext, String page)
574 throws Exception {
575
576 RequestDispatcher requestDispatcher =
577 servletContext.getRequestDispatcher(page);
578
579 requestDispatcher.include(_request, _response);
580 }
581
582 @Override
583 public void include(String page) throws Exception {
584 RequestDispatcher requestDispatcher =
585 DirectRequestDispatcherFactoryUtil.getRequestDispatcher(
586 _servletContext, page);
587
588 requestDispatcher.include(_request, _response);
589 }
590
591 @Override
592 public void journalArticle(
593 String articleId, long groupId, String ddmTemplateKey)
594 throws Exception {
595
596 JournalArticleTag journalArticleTag = new JournalArticleTag();
597
598 setUp(journalArticleTag);
599
600 journalArticleTag.setArticleId(articleId);
601 journalArticleTag.setGroupId(groupId);
602 journalArticleTag.setLanguageId(LanguageUtil.getLanguageId(_request));
603 journalArticleTag.setDDMTemplateKey(ddmTemplateKey);
604
605 journalArticleTag.runTag();
606 }
607
608 @Override
609 public void journalContentSearch() throws Exception {
610 journalContentSearch(true, null);
611 }
612
613 @Override
614 public void journalContentSearch(boolean showListed, String targetPortletId)
615 throws Exception {
616
617 JournalContentSearchTag journalContentSearchTag =
618 new JournalContentSearchTag();
619
620 setUp(journalContentSearchTag);
621
622 journalContentSearchTag.setShowListed(showListed);
623 journalContentSearchTag.setTargetPortletId(targetPortletId);
624
625 journalContentSearchTag.runTag();
626 }
627
628 @Override
629 public void language() throws Exception {
630 LanguageTag languageTag = new LanguageTag();
631
632 setUp(languageTag);
633
634 languageTag.runTag();
635 }
636
637 @Override
638 public void language(
639 String formName, String formAction, String name,
640 String ddmTemplateKey)
641 throws Exception {
642
643 LanguageTag languageTag = new LanguageTag();
644
645 setUp(languageTag);
646
647 languageTag.setDdmTemplateKey(ddmTemplateKey);
648 languageTag.setFormAction(formAction);
649 languageTag.setFormName(formName);
650 languageTag.setName(name);
651
652 languageTag.runTag();
653 }
654
655 @Override
656 public void language(
657 String formName, String formAction, String name,
658 String[] languageIds, String ddmTemplateKey)
659 throws Exception {
660
661 LanguageTag languageTag = new LanguageTag();
662
663 setUp(languageTag);
664
665 languageTag.setDdmTemplateKey(ddmTemplateKey);
666 languageTag.setFormAction(formAction);
667 languageTag.setFormName(formName);
668 languageTag.setLanguageIds(languageIds);
669 languageTag.setName(name);
670
671 languageTag.runTag();
672 }
673
674 @Override
675 public void layoutIcon(Layout layout) throws Exception {
676 LayoutIconTag.doTag(layout, _servletContext, _request, _response);
677 }
678
679 @Override
680 public void menu(Menu menu) throws Exception {
681 MenuTag menuTag = new MenuTag();
682
683 setUp(menuTag);
684
685 menuTag.setMenu(menu);
686
687 menuTag.runTag();
688 }
689
690 @Override
691 public void metaTags() throws Exception {
692 MetaTagsTag.doTag(_servletContext, _request, _response);
693 }
694
695
698 @Deprecated
699 @Override
700 public void myPlaces() throws Exception {
701 mySites();
702 }
703
704
707 @Deprecated
708 @Override
709 public void myPlaces(int max) throws Exception {
710 mySites(max);
711 }
712
713 @Override
714 public void mySites() throws Exception {
715 MySitesTag mySitesTag = new MySitesTag();
716
717 setUp(mySitesTag);
718
719 mySitesTag.runTag();
720 }
721
722 @Override
723 public void mySites(int max) throws Exception {
724 MySitesTag mySitesTag = new MySitesTag();
725
726 setUp(mySitesTag);
727
728 mySitesTag.setMax(max);
729
730 mySitesTag.runTag();
731 }
732
733 @Override
734 public String permissionsURL(
735 String redirect, String modelResource,
736 String modelResourceDescription, Object resourceGroupId,
737 String resourcePrimKey, String windowState, int[] roleTypes)
738 throws Exception {
739
740 return PermissionsURLTag.doTag(
741 redirect, modelResource, modelResourceDescription, resourceGroupId,
742 resourcePrimKey, windowState, roleTypes, _request);
743 }
744
745
749 @Deprecated
750 @Override
751 public String permissionsURL(
752 String redirect, String modelResource,
753 String modelResourceDescription, String resourcePrimKey,
754 String windowState, int[] roleTypes)
755 throws Exception {
756
757 return permissionsURL(
758 redirect, modelResourceDescription, modelResourceDescription, null,
759 resourcePrimKey, windowState, roleTypes);
760 }
761
762 @Override
763 public void portletIconBack() throws Exception {
764 IconBackTag iconBackTag = new IconBackTag();
765
766 setUp(iconBackTag);
767
768 iconBackTag.runTag();
769 }
770
771 @Override
772 public void portletIconOptions() throws Exception {
773 IconOptionsTag iconOptionsTag = new IconOptionsTag();
774
775 setUp(iconOptionsTag);
776
777 iconOptionsTag.runTag();
778 }
779
780 @Override
781 public void portletIconOptions(String direction, String markupView)
782 throws Exception {
783
784 IconOptionsTag iconOptionsTag = new IconOptionsTag();
785
786 setUp(iconOptionsTag);
787
788 iconOptionsTag.setDirection(direction);
789 iconOptionsTag.setMarkupView(markupView);
790
791 iconOptionsTag.runTag();
792 }
793
794 @Override
795 public void portletIconPortlet() throws Exception {
796 IconPortletTag iconPortletTag = new IconPortletTag();
797
798 setUp(iconPortletTag);
799
800 iconPortletTag.runTag();
801 }
802
803 @Override
804 public void portletIconPortlet(Portlet portlet) throws Exception {
805 IconPortletTag iconPortletTag = new IconPortletTag();
806
807 setUp(iconPortletTag);
808
809 iconPortletTag.setPortlet(portlet);
810
811 iconPortletTag.runTag();
812 }
813
814 @Override
815 public void quickAccess() throws Exception {
816 QuickAccessTag quickAccessTag = new QuickAccessTag();
817
818 setUp(quickAccessTag);
819
820 quickAccessTag.runTag();
821 }
822
823 @Override
824 public void quickAccess(String contentId) throws Exception {
825 QuickAccessTag quickAccessTag = new QuickAccessTag();
826
827 setUp(quickAccessTag);
828
829 quickAccessTag.setContentId(contentId);
830
831 quickAccessTag.runTag();
832 }
833
834 @Override
835 public void ratings(
836 String className, long classPK, int numberOfStars, String type,
837 String url)
838 throws Exception {
839
840 RatingsTag ratingsTag = new RatingsTag();
841
842 setUp(ratingsTag);
843
844 ratingsTag.setClassName(className);
845 ratingsTag.setClassPK(classPK);
846 ratingsTag.setNumberOfStars(numberOfStars);
847 ratingsTag.setType(type);
848 ratingsTag.setUrl(url);
849
850 ratingsTag.runTag();
851 }
852
853 @Override
854 public String renderURL(long plid, String portletName, String queryString)
855 throws Exception {
856
857 String windowState = WindowState.NORMAL.toString();
858 String portletMode = PortletMode.VIEW.toString();
859
860 return renderURL(
861 windowState, portletMode, plid, portletName, queryString);
862 }
863
864 @Override
865 public String renderURL(String portletName, String queryString)
866 throws Exception {
867
868 return renderURL(
869 LayoutConstants.DEFAULT_PLID, portletName, queryString);
870 }
871
872 @Override
873 public String renderURL(
874 String windowState, String portletMode, Boolean secure,
875 Boolean copyCurrentRenderParameters, Boolean escapeXml, long plid,
876 long refererPlid, String portletName, Boolean anchor,
877 Boolean encrypt, long doAsGroupId, long doAsUserId,
878 Boolean portletConfiguration, String queryString)
879 throws Exception {
880
881 String name = null;
882 String resourceID = null;
883 String cacheability = null;
884 Map<String, String[]> parameterMap = HttpUtil.parameterMapFromString(
885 queryString);
886 Set<String> removedParameterNames = null;
887
888 PortletURL portletURL = ActionURLTag.doTag(
889 PortletRequest.RENDER_PHASE, windowState, portletMode, secure,
890 copyCurrentRenderParameters, escapeXml, name, resourceID,
891 cacheability, plid, refererPlid, portletName, anchor, encrypt,
892 doAsGroupId, doAsUserId, portletConfiguration, parameterMap,
893 removedParameterNames, _request);
894
895 return portletURL.toString();
896 }
897
898
903 @Deprecated
904 @Override
905 public String renderURL(
906 String windowState, String portletMode, Boolean secure,
907 Boolean copyCurrentRenderParameters, Boolean escapeXml, long plid,
908 String portletName, Boolean anchor, Boolean encrypt,
909 long doAsUserId, Boolean portletConfiguration, String queryString)
910 throws Exception {
911
912 long refererPlid = LayoutConstants.DEFAULT_PLID;
913
914 return renderURL(
915 windowState, portletMode, secure, copyCurrentRenderParameters,
916 escapeXml, plid, refererPlid, portletName, anchor, encrypt, 0,
917 doAsUserId, portletConfiguration, queryString);
918 }
919
920 @Override
921 public String renderURL(
922 String windowState, String portletMode, long plid,
923 String portletName, String queryString)
924 throws Exception {
925
926 Boolean secure = null;
927 Boolean copyCurrentRenderParameters = null;
928 Boolean escapeXml = null;
929 long referPlid = LayoutConstants.DEFAULT_PLID;
930 Boolean anchor = null;
931 Boolean encrypt = null;
932 long doAsGroupId = 0;
933 long doAsUserId = 0;
934 Boolean portletConfiguration = null;
935
936 return renderURL(
937 windowState, portletMode, secure, copyCurrentRenderParameters,
938 escapeXml, plid, referPlid, portletName, anchor, encrypt,
939 doAsGroupId, doAsUserId, portletConfiguration, queryString);
940 }
941
942 @Override
943 public String renderURL(
944 String windowState, String portletMode, String portletName,
945 String queryString)
946 throws Exception {
947
948 return renderURL(
949 windowState, portletMode, LayoutConstants.DEFAULT_PLID, portletName,
950 queryString);
951 }
952
953 @Override
954 public void runtime(String portletName) throws Exception {
955 runtime(portletName, (String)null);
956 }
957
958 @Override
959 public void runtime(
960 String portletProviderClassName,
961 PortletProvider.Action portletProviderAction)
962 throws Exception {
963
964 RuntimeTag.doTag(
965 portletProviderClassName, portletProviderAction, StringPool.BLANK,
966 null, null, _pageContext, _request, _response);
967 }
968
969 @Override
970 public void runtime(
971 String portletProviderClassName,
972 PortletProvider.Action portletProviderAction, String instanceId)
973 throws Exception {
974
975 RuntimeTag.doTag(
976 portletProviderClassName, portletProviderAction, instanceId, null,
977 null, _pageContext, _request, _response);
978 }
979
980 @Override
981 public void runtime(
982 String portletProviderClassName,
983 PortletProvider.Action portletProviderAction, String instanceId,
984 String defaultPreferences)
985 throws Exception {
986
987 RuntimeTag.doTag(
988 portletProviderClassName, portletProviderAction, instanceId, null,
989 defaultPreferences, _pageContext, _request, _response);
990 }
991
992 @Override
993 public void runtime(String portletName, String queryString)
994 throws Exception {
995
996 RuntimeTag.doTag(
997 portletName, queryString, _pageContext, _request, _response);
998 }
999
1000 @Override
1001 public void runtime(
1002 String portletName, String queryString, String defaultPreferences)
1003 throws Exception {
1004
1005 RuntimeTag.doTag(
1006 portletName, queryString, defaultPreferences, _pageContext,
1007 _request, _response);
1008 }
1009
1010 @Override
1011 public void runtime(
1012 String portletName, String instanceId, String queryString,
1013 String defaultPreferences)
1014 throws Exception {
1015
1016 RuntimeTag.doTag(
1017 portletName, instanceId, queryString, defaultPreferences,
1018 _pageContext, _request, _response);
1019 }
1020
1021 @Override
1022 public void search() throws Exception {
1023 SearchTag searchTag = new SearchTag();
1024
1025 setUp(searchTag);
1026
1027 searchTag.runTag();
1028 }
1029
1030 @Override
1031 public void sitesDirectory() throws Exception {
1032 SitesDirectoryTag sitesDirectoryTag = new SitesDirectoryTag();
1033
1034 setUp(sitesDirectoryTag);
1035
1036 sitesDirectoryTag.runTag();
1037 }
1038
1039 @Override
1040 public void sitesDirectory(String displayStyle, String sites)
1041 throws Exception {
1042
1043 SitesDirectoryTag sitesDirectoryTag = new SitesDirectoryTag();
1044
1045 setUp(sitesDirectoryTag);
1046
1047 sitesDirectoryTag.setDisplayStyle(displayStyle);
1048 sitesDirectoryTag.setSites(sites);
1049
1050 sitesDirectoryTag.runTag();
1051 }
1052
1053 @Override
1054 public void socialBookmarks(
1055 String displayStyle, String target, String types, String title,
1056 String url)
1057 throws Exception {
1058
1059 SocialBookmarksTag socialBookmarksTag = new SocialBookmarksTag();
1060
1061 setUp(socialBookmarksTag);
1062
1063 socialBookmarksTag.setDisplayStyle(displayStyle);
1064 socialBookmarksTag.setTarget(target);
1065 socialBookmarksTag.setTypes(types);
1066 socialBookmarksTag.setTitle(title);
1067 socialBookmarksTag.setUrl(url);
1068
1069 socialBookmarksTag.runTag();
1070 }
1071
1072
1075 @Deprecated
1076 @Override
1077 public void staging() throws Exception {
1078 }
1079
1080 @Override
1081 public void toggle(
1082 String id, String showImage, String hideImage, String showMessage,
1083 String hideMessage, boolean defaultShowContent)
1084 throws Exception {
1085
1086 ToggleTag.doTag(
1087 id, showImage, hideImage, showMessage, hideMessage,
1088 defaultShowContent, null, _servletContext, _request, _response);
1089 }
1090
1091 @Override
1092 public String wrapPortlet(String wrapPage, String portletPage)
1093 throws Exception {
1094
1095 return WrapPortletTag.doTag(
1096 wrapPage, portletPage, _servletContext, _request, _response);
1097 }
1098
1099 protected void setUp(TagSupport tagSupport) throws Exception {
1100 Writer writer = null;
1101
1102 if (_contextObjects != null) {
1103 writer = (Writer)_contextObjects.get(TemplateConstants.WRITER);
1104 }
1105
1106 if (writer == null) {
1107 writer = _response.getWriter();
1108 }
1109
1110 tagSupport.setPageContext(new PipingPageContext(_pageContext, writer));
1111 }
1112
1113 private final Map<String, Object> _contextObjects;
1114 private final PageContext _pageContext;
1115 private final HttpServletRequest _request;
1116 private final HttpServletResponse _response;
1117 private final ServletContext _servletContext;
1118
1119 }