1
22
23 package com.liferay.taglib.ui;
24
25 import com.liferay.portal.kernel.servlet.StringServletResponse;
26 import com.liferay.portal.kernel.util.StringPool;
27 import com.liferay.portal.model.Theme;
28 import com.liferay.portal.util.WebKeys;
29 import com.liferay.taglib.util.ParamAndPropertyAncestorTagImpl;
30 import com.liferay.taglib.util.ThemeUtil;
31
32 import javax.servlet.RequestDispatcher;
33 import javax.servlet.ServletContext;
34 import javax.servlet.http.HttpServletRequest;
35 import javax.servlet.jsp.JspException;
36
37
42 public class BoxTag extends ParamAndPropertyAncestorTagImpl {
43
44 public int doStartTag() {
45 return EVAL_BODY_BUFFERED;
46 }
47
48 public int doAfterBody() {
49 _bodyContentString = getBodyContent().getString();
50
51 return SKIP_BODY;
52 }
53
54 public int doEndTag() throws JspException {
55 try {
56 ServletContext servletContext = getServletContext();
57 HttpServletRequest request = getServletRequest();
58 StringServletResponse stringResponse = getServletResponse();
59
60 Theme theme = (Theme)request.getAttribute(WebKeys.THEME);
61
62
64 if (isTheme()) {
65 ThemeUtil.include(
66 servletContext, request, stringResponse, pageContext,
67 getTop(), theme);
68 }
69 else {
70 RequestDispatcher requestDispatcher =
71 servletContext.getRequestDispatcher(getTop());
72
73 requestDispatcher.include(request, stringResponse);
74 }
75
76 pageContext.getOut().print(stringResponse.getString());
77
78
80 pageContext.getOut().print(_bodyContentString);
81
82
84 stringResponse.recycle();
86
87 if (isTheme()) {
88 ThemeUtil.include(
89 servletContext, request, stringResponse, pageContext,
90 getBottom(), theme);
91 }
92 else {
93 RequestDispatcher requestDispatcher =
94 servletContext.getRequestDispatcher(getBottom());
95
96 requestDispatcher.include(request, stringResponse);
97 }
98
99 pageContext.getOut().print(stringResponse.getString());
100
101 return EVAL_PAGE;
102 }
103 catch (Exception e) {
104 throw new JspException(e);
105 }
106 finally {
107 clearParams();
108 clearProperties();
109 }
110 }
111
112 public boolean isTheme() {
113 return false;
114 }
115
116 public String getTop() {
117 return _top;
118 }
119
120 public void setTop(String top) {
121 _top = top;
122 }
123
124 public String getBottom() {
125 return _bottom;
126 }
127
128 public void setBottom(String bottom) {
129 _bottom = bottom;
130 }
131
132 private String _top;
133 private String _bottom;
134 private String _bodyContentString = StringPool.BLANK;
135
136 }