1 29 30 package com.caucho.jsp; 31 32 import com.caucho.log.Log; 33 import com.caucho.server.connection.CauchoResponse; 34 import com.caucho.server.webapp.WebApp; 35 import com.caucho.util.FreeList; 36 import com.caucho.util.L10N; 37 38 import javax.servlet.ServletConfig ; 39 import javax.servlet.ServletContext ; 40 import javax.servlet.ServletRequest ; 41 import javax.servlet.ServletResponse ; 42 import javax.servlet.http.HttpServletRequest ; 43 import javax.servlet.http.HttpSession ; 44 import javax.servlet.jsp.ErrorData ; 45 import javax.servlet.jsp.JspContext ; 46 import javax.servlet.jsp.JspWriter ; 47 import javax.servlet.jsp.el.ExpressionEvaluator ; 48 import javax.servlet.jsp.tagext.BodyContent ; 49 import java.io.IOException ; 50 import java.io.PrintWriter ; 51 import java.io.Writer ; 52 import java.util.logging.Logger ; 53 54 public class PageContextWrapper extends PageContextImpl { 55 private static final Logger log = Log.open(PageContextWrapper.class); 56 static final L10N L = new L10N(PageContextWrapper.class); 57 58 private static final FreeList<PageContextWrapper> _freeList = 59 new FreeList<PageContextWrapper>(32); 60 61 private PageContextImpl _parent; 62 63 public void init(PageContextImpl parent) 64 { 65 _parent = parent; 66 clearAttributes(); 67 setOut(parent.getOut()); 68 _isFilled = true; 69 } 70 71 public static PageContextWrapper create(JspContext parent) 72 { 73 PageContextWrapper wrapper = _freeList.allocate(); 74 if (wrapper == null) 75 wrapper = new PageContextWrapper(); 76 77 wrapper.init((PageContextImpl) parent); 78 79 return wrapper; 80 } 81 82 85 public Object getPage() 86 { 87 return _parent.getPage(); 88 } 89 90 93 public ServletRequest getRequest() 94 { 95 return _parent.getRequest(); 96 } 97 98 101 public ServletResponse getResponse() 102 { 103 return _parent.getResponse(); 104 } 105 106 109 public HttpServletRequest getCauchoRequest() 110 { 111 return _parent.getCauchoRequest(); 112 } 113 114 117 public CauchoResponse getCauchoResponse() 118 { 119 return _parent.getCauchoResponse(); 120 } 121 122 public HttpSession getSession() 123 { 124 return _parent.getSession(); 125 } 126 127 public ServletConfig getServletConfig() 128 { 129 return _parent.getServletConfig(); 130 } 131 132 135 public ServletContext getServletContext() 136 { 137 return _parent.getServletContext(); 138 } 139 140 143 public WebApp getApplication() 144 { 145 return _parent.getApplication(); 146 } 147 148 151 public String getErrorPage() 152 { 153 return _parent.getErrorPage(); 154 } 155 156 159 public void setErrorPage(String errorPage) 160 { 161 _parent.setErrorPage(errorPage); 162 } 163 164 167 public Throwable getThrowable() 168 { 169 return _parent.getThrowable(); 170 } 171 172 175 public ErrorData getErrorData() 176 { 177 return _parent.getErrorData(); 178 } 179 180 183 public javax.servlet.jsp.el.VariableResolver getVariableResolver() 184 { 185 return _parent.getVariableResolver(); 186 } 187 188 191 public JspWriter getOut() 192 { 193 return _parent.getOut(); 194 } 195 196 199 public BodyContent pushBody() 200 { 201 return _parent.pushBody(); 202 } 203 204 207 public JspWriter pushBody(Writer out) 208 { 209 return _parent.pushBody(out); 210 } 211 212 217 public JspWriter popAndReleaseBody() 218 throws IOException 219 { 220 return _parent.popAndReleaseBody(); 221 } 222 223 226 public JspWriter popBody() 227 { 228 return _parent.popBody(); 229 } 230 231 public void releaseBody(BodyContentImpl out) 232 throws IOException 233 { 234 _parent.releaseBody(out); 235 } 236 237 242 public JspWriter setWriter(JspWriter oldWriter) 243 { 244 return _parent.setWriter(oldWriter); 245 } 246 247 250 public PrintWriter getTopWriter() 251 throws IOException 252 { 253 return _parent.getTopWriter(); 254 } 255 256 259 public ExpressionEvaluator getExpressionEvaluator() 260 { 261 return _parent.getExpressionEvaluator(); 262 } 263 264 public static void free(PageContextWrapper wrapper) 265 { 266 _freeList.free(wrapper); 267 } 268 } 269 | Popular Tags |