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