Author: remm Date: Tue Sep 19 18:15:32 2006 New Revision: 448022 URL: http://svn.apache.org/viewvc?view=rev&rev=448022 Log: - Remove apparently useless fields from the page context. - Attributes are now a HashMap, since the page context is a per request object.
Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java?view=diff&rev=448022&r1=448021&r2=448022 ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java Tue Sep 19 18:15:32 2006 @@ -95,17 +95,17 @@ 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!! */ Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java?view=diff&rev=448022&r1=448021&r2=448022 ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/runtime/PageContextImpl.java Tue Sep 19 18:15:32 2006 @@ -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.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.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 @@ 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<String, Object> 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 @@ private boolean isIncluded; - // - // initial output stream private transient JspWriter out; @@ -124,10 +112,9 @@ /* * Constructor. */ - PageContextImpl(JspFactory factory) { - this.factory = factory; + PageContextImpl() { this.outs = new BodyContentImpl[0]; - this.attributes = new Hashtable(16); + this.attributes = new HashMap<String, Object>(16); this.depth = -1; } @@ -149,10 +136,7 @@ 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 @@ 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 @@ 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(); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]