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