From: remm Date: Wed, 20 Sep 2006 01:15:32 +0000 (+0000) Subject: - Remove apparently useless fields from the page context. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=41ecd996f41c349ce20069416477c2471532aef2;p=tomcat7.0 - Remove apparently useless fields from the page context. - Attributes are now a HashMap, since the page context is a per request object. git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@448022 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/jasper/runtime/JspFactoryImpl.java b/java/org/apache/jasper/runtime/JspFactoryImpl.java index 7408eb834..e1293b27e 100644 --- a/java/org/apache/jasper/runtime/JspFactoryImpl.java +++ b/java/org/apache/jasper/runtime/JspFactoryImpl.java @@ -95,17 +95,17 @@ public class JspFactoryImpl extends JspFactory { int bufferSize, boolean autoflush) { try { - PageContext pc; - if( USE_POOL ) { + PageContext pc; + if( USE_POOL ) { pc = (PageContext) pool.get(); - if( pc == null ) { - pc= new PageContextImpl(this); - } - } else { - pc = new PageContextImpl(this); - } - pc.initialize(servlet, request, response, errorPageURL, - needsSession, bufferSize, autoflush); + if( pc == null ) { + pc = new PageContextImpl(); + } + } else { + pc = new PageContextImpl(); + } + pc.initialize(servlet, request, response, errorPageURL, + needsSession, bufferSize, autoflush); return pc; } catch (Throwable ex) { /* FIXME: need to do something reasonable here!! */ diff --git a/java/org/apache/jasper/runtime/PageContextImpl.java b/java/org/apache/jasper/runtime/PageContextImpl.java index 501efd814..6610da7bf 100644 --- a/java/org/apache/jasper/runtime/PageContextImpl.java +++ b/java/org/apache/jasper/runtime/PageContextImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 1999,2004 The Apache Software Foundation. + * Copyright 1999,2004-2006 The Apache Software Foundation. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +23,9 @@ import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.Enumeration; -import java.util.Hashtable; +import java.util.HashMap; import javax.el.ELContext; -import javax.el.ELResolver; import javax.el.ExpressionFactory; import javax.el.ValueExpression; import javax.servlet.Servlet; @@ -56,6 +55,7 @@ import org.apache.jasper.el.ExpressionEvaluatorImpl; import org.apache.jasper.el.FunctionMapperImpl; import org.apache.jasper.el.VariableResolverImpl; import org.apache.jasper.security.SecurityUtil; +import org.apache.jasper.util.Enumerator; /** * Implementation of the PageContext class from the JSP spec. Also doubles as a @@ -85,28 +85,18 @@ public class PageContextImpl extends PageContext { private ServletContext context; - private JspFactory factory; - private JspApplicationContextImpl applicationContext; - private boolean needsSession; - private String errorPageURL; - private boolean autoFlush; - - private int bufferSize; - // page-scope attributes - private transient Hashtable attributes; + private transient HashMap attributes; // per-request state private transient ServletRequest request; private transient ServletResponse response; - private transient Object page; - private transient HttpSession session; private transient ELContextImpl elContext; @@ -114,8 +104,6 @@ public class PageContextImpl extends PageContext { private boolean isIncluded; - // - // initial output stream private transient JspWriter out; @@ -124,10 +112,9 @@ public class PageContextImpl extends PageContext { /* * Constructor. */ - PageContextImpl(JspFactory factory) { - this.factory = factory; + PageContextImpl() { this.outs = new BodyContentImpl[0]; - this.attributes = new Hashtable(16); + this.attributes = new HashMap(16); this.depth = -1; } @@ -149,10 +136,7 @@ public class PageContextImpl extends PageContext { this.servlet = servlet; this.config = servlet.getServletConfig(); this.context = config.getServletContext(); - this.needsSession = needsSession; this.errorPageURL = errorPageURL; - this.bufferSize = bufferSize; - this.autoFlush = autoFlush; this.request = request; this.response = response; @@ -214,10 +198,7 @@ public class PageContextImpl extends PageContext { context = null; applicationContext = null; elContext = null; - needsSession = false; errorPageURL = null; - bufferSize = JspWriter.DEFAULT_BUFFER; - autoFlush = true; request = null; response = null; depth = -1; @@ -509,7 +490,7 @@ public class PageContextImpl extends PageContext { private Enumeration doGetAttributeNamesInScope(int scope) { switch (scope) { case PAGE_SCOPE: - return attributes.keys(); + return new Enumerator(attributes.keySet().iterator()); case REQUEST_SCOPE: return request.getAttributeNames();