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 doAfterBody() {
45 _bodyContentString = getBodyContent().getString();
46
47 return SKIP_BODY;
48 }
49
50 public int doEndTag() throws JspException {
51 try {
52 ServletContext servletContext = getServletContext();
53 HttpServletRequest request = getServletRequest();
54 StringServletResponse stringResponse = getServletResponse();
55
56 Theme theme = (Theme)request.getAttribute(WebKeys.THEME);
57
58
60 if (isTheme()) {
61 ThemeUtil.include(
62 servletContext, request, stringResponse, pageContext,
63 getTop(), theme);
64 }
65 else {
66 RequestDispatcher requestDispatcher =
67 servletContext.getRequestDispatcher(getTop());
68
69 requestDispatcher.include(request, stringResponse);
70 }
71
72 pageContext.getOut().print(stringResponse.getString());
73
74
76 pageContext.getOut().print(_bodyContentString);
77
78
80 stringResponse.recycle();
82
83 if (isTheme()) {
84 ThemeUtil.include(
85 servletContext, request, stringResponse, pageContext,
86 getBottom(), theme);
87 }
88 else {
89 RequestDispatcher requestDispatcher =
90 servletContext.getRequestDispatcher(getBottom());
91
92 requestDispatcher.include(request, stringResponse);
93 }
94
95 pageContext.getOut().print(stringResponse.getString());
96
97 return EVAL_PAGE;
98 }
99 catch (Exception e) {
100 throw new JspException(e);
101 }
102 finally {
103 clearParams();
104 clearProperties();
105 }
106 }
107
108 public int doStartTag() {
109 return EVAL_BODY_BUFFERED;
110 }
111
112 public String getBottom() {
113 return _bottom;
114 }
115
116 public String getTop() {
117 return _top;
118 }
119
120 public boolean isTheme() {
121 return false;
122 }
123
124 public void setBottom(String bottom) {
125 _bottom = bottom;
126 }
127
128 public void setTop(String top) {
129 _top = top;
130 }
131
132 private String _bodyContentString = StringPool.BLANK;
133 private String _bottom;
134 private String _top;
135
136 }