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