Author: remy.maucherat(a)jboss.com
Date: 2009-02-23 08:56:28 -0500 (Mon, 23 Feb 2009)
New Revision: 939
Modified:
branches/2.1.x/build.properties.default
branches/2.1.x/java/org/apache/catalina/startup/WebRuleSet.java
branches/2.1.x/java/org/apache/coyote/http11/Http11AprProtocol.java
branches/2.1.x/java/org/apache/coyote/http11/Http11Protocol.java
branches/2.1.x/java/org/apache/jasper/el/ELContextImpl.java
branches/2.1.x/java/org/apache/jasper/el/ELResolverImpl.java
branches/2.1.x/java/org/apache/jasper/el/ExpressionEvaluatorImpl.java
branches/2.1.x/webapps/docs/changelog.xml
Log:
- Port Tomcat patches, incl EL resolver improvement for the security manager.
Modified: branches/2.1.x/build.properties.default
===================================================================
--- branches/2.1.x/build.properties.default 2009-02-23 13:56:06 UTC (rev 938)
+++ branches/2.1.x/build.properties.default 2009-02-23 13:56:28 UTC (rev 939)
@@ -12,7 +12,7 @@
# ----- Version Control Flags -----
version.major=2
version.minor=1
-version.build=1
+version.build=3
version.patch=0
version.tag=SNAPSHOT
Modified: branches/2.1.x/java/org/apache/catalina/startup/WebRuleSet.java
===================================================================
--- branches/2.1.x/java/org/apache/catalina/startup/WebRuleSet.java 2009-02-23 13:56:06
UTC (rev 938)
+++ branches/2.1.x/java/org/apache/catalina/startup/WebRuleSet.java 2009-02-23 13:56:28
UTC (rev 939)
@@ -539,7 +539,7 @@
throws Exception {
if (isLoginConfigSet){
throw new IllegalArgumentException(
- "<login-config> element is limited to 1 occurance");
+ "<login-config> element is limited to 1 occurrence");
}
isLoginConfigSet = true;
}
@@ -560,7 +560,7 @@
throws Exception {
if (isJspConfigSet){
throw new IllegalArgumentException(
- "<jsp-config> element is limited to 1 occurance");
+ "<jsp-config> element is limited to 1 occurrence");
}
isJspConfigSet = true;
}
@@ -581,7 +581,7 @@
throws Exception {
if (isSessionConfigSet){
throw new IllegalArgumentException(
- "<session-config> element is limited to 1 occurance");
+ "<session-config> element is limited to 1 occurrence");
}
isSessionConfigSet = true;
}
Modified: branches/2.1.x/java/org/apache/coyote/http11/Http11AprProtocol.java
===================================================================
--- branches/2.1.x/java/org/apache/coyote/http11/Http11AprProtocol.java 2009-02-23
13:56:06 UTC (rev 938)
+++ branches/2.1.x/java/org/apache/coyote/http11/Http11AprProtocol.java 2009-02-23
13:56:28 UTC (rev 939)
@@ -32,7 +32,6 @@
import javax.management.ObjectName;
import org.apache.coyote.ActionCode;
-import org.apache.coyote.ActionHook;
import org.apache.coyote.Adapter;
import org.apache.coyote.ProtocolHandler;
import org.apache.coyote.RequestGroupInfo;
@@ -588,9 +587,7 @@
processor = createProcessor();
}
- if (processor instanceof ActionHook) {
- ((ActionHook) processor).action(ActionCode.ACTION_START, null);
- }
+ processor.action(ActionCode.ACTION_START, null);
SocketState state = processor.process(socket);
if (state == SocketState.LONG) {
Modified: branches/2.1.x/java/org/apache/coyote/http11/Http11Protocol.java
===================================================================
--- branches/2.1.x/java/org/apache/coyote/http11/Http11Protocol.java 2009-02-23 13:56:06
UTC (rev 938)
+++ branches/2.1.x/java/org/apache/coyote/http11/Http11Protocol.java 2009-02-23 13:56:28
UTC (rev 939)
@@ -32,7 +32,6 @@
import javax.management.ObjectName;
import org.apache.coyote.ActionCode;
-import org.apache.coyote.ActionHook;
import org.apache.coyote.Adapter;
import org.apache.coyote.ProtocolHandler;
import org.apache.coyote.RequestGroupInfo;
@@ -587,9 +586,7 @@
processor = createProcessor();
}
- if (processor instanceof ActionHook) {
- ((ActionHook) processor).action(ActionCode.ACTION_START, null);
- }
+ processor.action(ActionCode.ACTION_START, null);
if (proto.secure && (proto.sslImplementation != null)) {
processor.setSSLSupport
@@ -625,9 +622,7 @@
// if(proto.adapter != null) proto.adapter.recycle();
// processor.recycle();
- if (processor instanceof ActionHook) {
- ((ActionHook) processor).action(ActionCode.ACTION_STOP, null);
- }
+ processor.action(ActionCode.ACTION_STOP, null);
recycledProcessors.offer(processor);
}
return false;
Modified: branches/2.1.x/java/org/apache/jasper/el/ELContextImpl.java
===================================================================
--- branches/2.1.x/java/org/apache/jasper/el/ELContextImpl.java 2009-02-23 13:56:06 UTC
(rev 938)
+++ branches/2.1.x/java/org/apache/jasper/el/ELContextImpl.java 2009-02-23 13:56:28 UTC
(rev 939)
@@ -26,6 +26,8 @@
import javax.el.ValueExpression;
import javax.el.VariableMapper;
+import org.apache.catalina.Globals;
+
/**
* Implementation of ELContext
*
@@ -61,12 +63,21 @@
private final ELResolver resolver;
- private FunctionMapper functionMapper = NullFunctionMapper; // immutable
+ private FunctionMapper functionMapper;
private VariableMapper variableMapper;
public ELContextImpl() {
- this(ELResolverImpl.DefaultResolver);
+ this(ELResolverImpl.getDefaultResolver());
+ if (Globals.IS_SECURITY_ENABLED) {
+ functionMapper = new FunctionMapper() {
+ public Method resolveFunction(String prefix, String localName) {
+ return null;
+ }
+ };
+ } else {
+ functionMapper = NullFunctionMapper;
+ }
}
public ELContextImpl(ELResolver resolver) {
Modified: branches/2.1.x/java/org/apache/jasper/el/ELResolverImpl.java
===================================================================
--- branches/2.1.x/java/org/apache/jasper/el/ELResolverImpl.java 2009-02-23 13:56:06 UTC
(rev 938)
+++ branches/2.1.x/java/org/apache/jasper/el/ELResolverImpl.java 2009-02-23 13:56:28 UTC
(rev 939)
@@ -32,115 +32,130 @@
import javax.el.ResourceBundleELResolver;
import javax.servlet.jsp.el.VariableResolver;
+import org.apache.catalina.Globals;
+
public final class ELResolverImpl extends ELResolver {
-
- public final static ELResolver DefaultResolver = new CompositeELResolver();
+ /** @deprecated - Use getDefaultResolver(). Needs to be made private */
+ public final static ELResolver DefaultResolver = new CompositeELResolver();
- static {
- ((CompositeELResolver) DefaultResolver).add(new MapELResolver());
- ((CompositeELResolver) DefaultResolver).add(new ResourceBundleELResolver());
- ((CompositeELResolver) DefaultResolver).add(new ListELResolver());
- ((CompositeELResolver) DefaultResolver).add(new ArrayELResolver());
- ((CompositeELResolver) DefaultResolver).add(new BeanELResolver());
- }
+ static {
+ ((CompositeELResolver) DefaultResolver).add(new MapELResolver());
+ ((CompositeELResolver) DefaultResolver).add(new ResourceBundleELResolver());
+ ((CompositeELResolver) DefaultResolver).add(new ListELResolver());
+ ((CompositeELResolver) DefaultResolver).add(new ArrayELResolver());
+ ((CompositeELResolver) DefaultResolver).add(new BeanELResolver());
+ }
- private final VariableResolver variableResolver;
+ private final VariableResolver variableResolver;
- public ELResolverImpl(VariableResolver variableResolver) {
- this.variableResolver = variableResolver;
- }
+ public ELResolverImpl(VariableResolver variableResolver) {
+ this.variableResolver = variableResolver;
+ }
- public Object getValue(ELContext context, Object base, Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
- if (context == null) {
- throw new NullPointerException();
- }
+ public Object getValue(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
- if (base == null) {
- context.setPropertyResolved(true);
- if (property != null) {
- try {
- return this.variableResolver.resolveVariable(property
- .toString());
- } catch (javax.servlet.jsp.el.ELException e) {
- throw new ELException(e.getMessage(), e.getCause());
- }
- }
- }
+ if (base == null) {
+ context.setPropertyResolved(true);
+ if (property != null) {
+ try {
+ return this.variableResolver.resolveVariable(property
+ .toString());
+ } catch (javax.servlet.jsp.el.ELException e) {
+ throw new ELException(e.getMessage(), e.getCause());
+ }
+ }
+ }
- if (!context.isPropertyResolved()) {
- return DefaultResolver.getValue(context, base, property);
- }
- return null;
- }
+ if (!context.isPropertyResolved()) {
+ return getDefaultResolver().getValue(context, base, property);
+ }
+ return null;
+ }
- public Class<?> getType(ELContext context, Object base, Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
- if (context == null) {
- throw new NullPointerException();
- }
+ public Class<?> getType(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
- if (base == null) {
- context.setPropertyResolved(true);
- if (property != null) {
- try {
- Object obj = this.variableResolver.resolveVariable(property
- .toString());
- return (obj != null) ? obj.getClass() : null;
- } catch (javax.servlet.jsp.el.ELException e) {
- throw new ELException(e.getMessage(), e.getCause());
- }
- }
- }
+ if (base == null) {
+ context.setPropertyResolved(true);
+ if (property != null) {
+ try {
+ Object obj = this.variableResolver.resolveVariable(property
+ .toString());
+ return (obj != null) ? obj.getClass() : null;
+ } catch (javax.servlet.jsp.el.ELException e) {
+ throw new ELException(e.getMessage(), e.getCause());
+ }
+ }
+ }
- if (!context.isPropertyResolved()) {
- return DefaultResolver.getType(context, base, property);
- }
- return null;
- }
+ if (!context.isPropertyResolved()) {
+ return getDefaultResolver().getType(context, base, property);
+ }
+ return null;
+ }
- public void setValue(ELContext context, Object base, Object property,
- Object value) throws NullPointerException,
- PropertyNotFoundException, PropertyNotWritableException,
- ELException {
- if (context == null) {
- throw new NullPointerException();
- }
+ public void setValue(ELContext context, Object base, Object property,
+ Object value) throws NullPointerException,
+ PropertyNotFoundException, PropertyNotWritableException,
+ ELException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
- if (base == null) {
- context.setPropertyResolved(true);
- throw new PropertyNotWritableException(
- "Legacy VariableResolver wrapped, not writable");
- }
+ if (base == null) {
+ context.setPropertyResolved(true);
+ throw new PropertyNotWritableException(
+ "Legacy VariableResolver wrapped, not writable");
+ }
- if (!context.isPropertyResolved()) {
- DefaultResolver.setValue(context, base, property, value);
- }
- }
+ if (!context.isPropertyResolved()) {
+ getDefaultResolver().setValue(context, base, property, value);
+ }
+ }
- public boolean isReadOnly(ELContext context, Object base, Object property)
- throws NullPointerException, PropertyNotFoundException, ELException {
- if (context == null) {
- throw new NullPointerException();
- }
+ public boolean isReadOnly(ELContext context, Object base, Object property)
+ throws NullPointerException, PropertyNotFoundException, ELException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
- if (base == null) {
- context.setPropertyResolved(true);
- return true;
- }
+ if (base == null) {
+ context.setPropertyResolved(true);
+ return true;
+ }
- return DefaultResolver.isReadOnly(context, base, property);
- }
+ return getDefaultResolver().isReadOnly(context, base, property);
+ }
- public Iterator<java.beans.FeatureDescriptor> getFeatureDescriptors(ELContext
context, Object base) {
- return DefaultResolver.getFeatureDescriptors(context, base);
- }
+ public Iterator<java.beans.FeatureDescriptor> getFeatureDescriptors(ELContext
context, Object base) {
+ return getDefaultResolver().getFeatureDescriptors(context, base);
+ }
- public Class<?> getCommonPropertyType(ELContext context, Object base) {
- if (base == null) {
- return String.class;
- }
- return DefaultResolver.getCommonPropertyType(context, base);
- }
+ public Class<?> getCommonPropertyType(ELContext context, Object base) {
+ if (base == null) {
+ return String.class;
+ }
+ return getDefaultResolver().getCommonPropertyType(context, base);
+ }
+ public static ELResolver getDefaultResolver() {
+ if (Globals.IS_SECURITY_ENABLED) {
+ ELResolver defaultResolver = new CompositeELResolver();
+ ((CompositeELResolver) defaultResolver).add(new MapELResolver());
+ ((CompositeELResolver) defaultResolver).add(new ResourceBundleELResolver());
+ ((CompositeELResolver) defaultResolver).add(new ListELResolver());
+ ((CompositeELResolver) defaultResolver).add(new ArrayELResolver());
+ ((CompositeELResolver) defaultResolver).add(new BeanELResolver());
+ return defaultResolver;
+ } else {
+ return DefaultResolver;
+ }
+ }
}
Modified: branches/2.1.x/java/org/apache/jasper/el/ExpressionEvaluatorImpl.java
===================================================================
--- branches/2.1.x/java/org/apache/jasper/el/ExpressionEvaluatorImpl.java 2009-02-23
13:56:06 UTC (rev 938)
+++ branches/2.1.x/java/org/apache/jasper/el/ExpressionEvaluatorImpl.java 2009-02-23
13:56:28 UTC (rev 939)
@@ -16,7 +16,6 @@
*/
package org.apache.jasper.el;
-import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
import javax.servlet.jsp.el.ELException;
@@ -29,30 +28,31 @@
public final class ExpressionEvaluatorImpl extends ExpressionEvaluator {
- private final ExpressionFactory factory;
-
- public ExpressionEvaluatorImpl(ExpressionFactory factory) {
- this.factory = factory;
- }
+ private final ExpressionFactory factory;
+
+ public ExpressionEvaluatorImpl(ExpressionFactory factory) {
+ this.factory = factory;
+ }
- public Expression parseExpression(String expression, Class expectedType,
- FunctionMapper fMapper) throws ELException {
- try {
- ELContextImpl ctx = new ELContextImpl(ELResolverImpl.DefaultResolver);
+ public Expression parseExpression(String expression, Class expectedType,
+ FunctionMapper fMapper) throws ELException {
+ try {
+ ELContextImpl ctx =
+ new ELContextImpl(ELResolverImpl.getDefaultResolver());
if (fMapper != null) {
ctx.setFunctionMapper(new FunctionMapperImpl(fMapper));
}
- ValueExpression ve = this.factory.createValueExpression(ctx, expression,
expectedType);
- return new ExpressionImpl(ve);
- } catch (javax.el.ELException e) {
- throw new ELParseException(e.getMessage());
- }
- }
+ ValueExpression ve = this.factory.createValueExpression(ctx, expression,
expectedType);
+ return new ExpressionImpl(ve);
+ } catch (javax.el.ELException e) {
+ throw new ELParseException(e.getMessage());
+ }
+ }
- public Object evaluate(String expression, Class expectedType,
- VariableResolver vResolver, FunctionMapper fMapper)
- throws ELException {
- return this.parseExpression(expression, expectedType, fMapper).evaluate(vResolver);
- }
+ public Object evaluate(String expression, Class expectedType,
+ VariableResolver vResolver, FunctionMapper fMapper)
+ throws ELException {
+ return this.parseExpression(expression, expectedType,
fMapper).evaluate(vResolver);
+ }
}
Modified: branches/2.1.x/webapps/docs/changelog.xml
===================================================================
--- branches/2.1.x/webapps/docs/changelog.xml 2009-02-23 13:56:06 UTC (rev 938)
+++ branches/2.1.x/webapps/docs/changelog.xml 2009-02-23 13:56:28 UTC (rev 939)
@@ -16,6 +16,31 @@
<body>
+<section name="JBoss Web 2.1.3.CR1 (remm)">
+ <subsection name="General">
+ <changelog>
+ </changelog>
+ </subsection>
+ <subsection name="Catalina">
+ <changelog>
+ </changelog>
+ </subsection>
+ <subsection name="Coyote">
+ <changelog>
+ <fix>
+ Remove useless instanceof in the HTTP protocol. (markt)
+ </fix>
+ </changelog>
+ </subsection>
+ <subsection name="Jasper">
+ <changelog>
+ <fix>
+ EL resolver improvements when using a security manager. (markt)
+ </fix>
+ </changelog>
+ </subsection>
+</section>
+
<section name="JBoss Web 2.1.2.GA (remm)">
<subsection name="General">
<changelog>