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