001
014
015 package com.liferay.taglib.servlet;
016
017 import com.liferay.portal.kernel.io.unsync.UnsyncStringWriter;
018 import com.liferay.taglib.BodyContentWrapper;
019
020 import java.io.IOException;
021 import java.io.Writer;
022
023 import java.util.Enumeration;
024
025 import javax.el.ELContext;
026
027 import javax.servlet.Servlet;
028 import javax.servlet.ServletConfig;
029 import javax.servlet.ServletContext;
030 import javax.servlet.ServletException;
031 import javax.servlet.ServletRequest;
032 import javax.servlet.ServletResponse;
033 import javax.servlet.http.HttpSession;
034 import javax.servlet.jsp.ErrorData;
035 import javax.servlet.jsp.JspWriter;
036 import javax.servlet.jsp.PageContext;
037 import javax.servlet.jsp.tagext.BodyContent;
038
039
043 public class PageContextWrapper extends PageContext {
044
045 public PageContextWrapper(PageContext pageContext) {
046 _pageContext = pageContext;
047 }
048
049 @Override
050 public Object findAttribute(String name) {
051 return _pageContext.findAttribute(name);
052 }
053
054 @Override
055 public void forward(String relativeUrlPath)
056 throws IOException, ServletException {
057
058 _pageContext.forward(relativeUrlPath);
059 }
060
061 @Override
062 public Object getAttribute(String name) {
063 return _pageContext.getAttribute(name);
064 }
065
066 @Override
067 public Object getAttribute(String name, int scope) {
068 return _pageContext.getAttribute(name, scope);
069 }
070
071 @Override
072 public Enumeration<String> getAttributeNamesInScope(int scope) {
073 return _pageContext.getAttributeNamesInScope(scope);
074 }
075
076 @Override
077 public int getAttributesScope(String name) {
078 return _pageContext.getAttributesScope(name);
079 }
080
081 @Override
082 public ELContext getELContext() {
083 return _pageContext.getELContext();
084 }
085
086 @Override
087 public ErrorData getErrorData() {
088 return super.getErrorData();
089 }
090
091 @Override
092 public Exception getException() {
093 return _pageContext.getException();
094 }
095
096
099 @Deprecated
100 @Override
101 public javax.servlet.jsp.el.ExpressionEvaluator getExpressionEvaluator() {
102 return _pageContext.getExpressionEvaluator();
103 }
104
105 @Override
106 public JspWriter getOut() {
107 return _pageContext.getOut();
108 }
109
110 @Override
111 public Object getPage() {
112 return _pageContext.getPage();
113 }
114
115 @Override
116 public ServletRequest getRequest() {
117 return _pageContext.getRequest();
118 }
119
120 @Override
121 public ServletResponse getResponse() {
122 return _pageContext.getResponse();
123 }
124
125 @Override
126 public ServletConfig getServletConfig() {
127 return _pageContext.getServletConfig();
128 }
129
130 @Override
131 public ServletContext getServletContext() {
132 return _pageContext.getServletContext();
133 }
134
135 @Override
136 public HttpSession getSession() {
137 return _pageContext.getSession();
138 }
139
140
143 @Deprecated
144 @Override
145 public javax.servlet.jsp.el.VariableResolver getVariableResolver() {
146 return _pageContext.getVariableResolver();
147 }
148
149 public PageContext getWrappedPageContext() {
150 return _pageContext;
151 }
152
153 @Override
154 public void handlePageException(Exception e)
155 throws IOException, ServletException {
156
157 _pageContext.handlePageException(e);
158 }
159
160 @Override
161 public void handlePageException(Throwable t)
162 throws IOException, ServletException {
163
164 _pageContext.handlePageException(t);
165 }
166
167 @Override
168 public void include(String relativeUrlPath)
169 throws IOException, ServletException {
170
171 _pageContext.include(relativeUrlPath);
172 }
173
174 @Override
175 public void include(String relativeUrlPath, boolean flush)
176 throws IOException, ServletException {
177
178 _pageContext.include(relativeUrlPath, flush);
179 }
180
181 @Override
182 public void initialize(
183 Servlet servlet, ServletRequest servletRequest,
184 ServletResponse servletResponse, String errorPageURL,
185 boolean needsSession, int bufferSize, boolean autoFlush)
186 throws IllegalArgumentException, IllegalStateException, IOException {
187
188 _pageContext.initialize(
189 servlet, servletRequest, servletResponse, errorPageURL,
190 needsSession, bufferSize, autoFlush);
191 }
192
193 @Override
194 public JspWriter popBody() {
195 return _pageContext.popBody();
196 }
197
198 @Override
199 public BodyContent pushBody() {
200 UnsyncStringWriter unsyncStringWriter = new UnsyncStringWriter();
201
202 BodyContent bodyContent = (BodyContent)_pageContext.pushBody(
203 unsyncStringWriter);
204
205 return new BodyContentWrapper(bodyContent, unsyncStringWriter);
206 }
207
208 @Override
209 public JspWriter pushBody(Writer writer) {
210 return _pageContext.pushBody(new PipingJspWriter(writer));
211 }
212
213 @Override
214 public void release() {
215 _pageContext.release();
216 }
217
218 @Override
219 public void removeAttribute(String name) {
220 _pageContext.removeAttribute(name);
221 }
222
223 @Override
224 public void removeAttribute(String name, int scope) {
225 _pageContext.removeAttribute(name, scope);
226 }
227
228 @Override
229 public void setAttribute(String name, Object value) {
230 _pageContext.setAttribute(name, value);
231 }
232
233 @Override
234 public void setAttribute(String name, Object value, int scope) {
235 _pageContext.setAttribute(name, value, scope);
236 }
237
238 private final PageContext _pageContext;
239
240 }