You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/07/10 23:30:08 UTC

svn commit: r1502011 - in /tomcat/trunk/java: javax/el/ org/apache/el/ org/apache/jasper/el/

Author: markt
Date: Wed Jul 10 21:30:08 2013
New Revision: 1502011

URL: http://svn.apache.org/r1502011
Log:
Implement EL listener notifications for expression evaluations.

Modified:
    tomcat/trunk/java/javax/el/ValueExpression.java
    tomcat/trunk/java/org/apache/el/MethodExpressionImpl.java
    tomcat/trunk/java/org/apache/el/MethodExpressionLiteral.java
    tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java
    tomcat/trunk/java/org/apache/el/ValueExpressionLiteral.java
    tomcat/trunk/java/org/apache/jasper/el/JspMethodExpression.java
    tomcat/trunk/java/org/apache/jasper/el/JspValueExpression.java

Modified: tomcat/trunk/java/javax/el/ValueExpression.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/ValueExpression.java?rev=1502011&r1=1502010&r2=1502011&view=diff
==============================================================================
--- tomcat/trunk/java/javax/el/ValueExpression.java (original)
+++ tomcat/trunk/java/javax/el/ValueExpression.java Wed Jul 10 21:30:08 2013
@@ -76,8 +76,10 @@ public abstract class ValueExpression ex
     /**
      * @since EL 2.2
      */
-    public ValueReference getValueReference(@SuppressWarnings("unused") ELContext context) {
-     // Expected to be over-ridden by implementation
+    public ValueReference getValueReference(ELContext context) {
+        // Expected to be over-ridden by implementation
+        context.notifyBeforeEvaluation(getExpressionString());
+        context.notifyAfterEvaluation(getExpressionString());
         return null;
     }
 }

Modified: tomcat/trunk/java/org/apache/el/MethodExpressionImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/MethodExpressionImpl.java?rev=1502011&r1=1502010&r2=1502011&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/MethodExpressionImpl.java (original)
+++ tomcat/trunk/java/org/apache/el/MethodExpressionImpl.java Wed Jul 10 21:30:08 2013
@@ -203,7 +203,10 @@ public final class MethodExpressionImpl 
         Node n = this.getNode();
         EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
                 this.varMapper);
-        return n.getMethodInfo(ctx, this.paramTypes);
+        ctx.notifyBeforeEvaluation(getExpressionString());
+        MethodInfo result = n.getMethodInfo(ctx, this.paramTypes);
+        ctx.notifyAfterEvaluation(getExpressionString());
+        return result;
     }
 
     private Node getNode() throws ELException {
@@ -271,7 +274,10 @@ public final class MethodExpressionImpl 
             ELException {
         EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
                 this.varMapper);
-        return this.getNode().invoke(ctx, this.paramTypes, params);
+        ctx.notifyBeforeEvaluation(getExpressionString());
+        Object result = this.getNode().invoke(ctx, this.paramTypes, params);
+        ctx.notifyAfterEvaluation(getExpressionString());
+        return result;
     }
 
     /*

Modified: tomcat/trunk/java/org/apache/el/MethodExpressionLiteral.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/MethodExpressionLiteral.java?rev=1502011&r1=1502010&r2=1502011&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/MethodExpressionLiteral.java (original)
+++ tomcat/trunk/java/org/apache/el/MethodExpressionLiteral.java Wed Jul 10 21:30:08 2013
@@ -51,16 +51,24 @@ public class MethodExpressionLiteral ext
 
     @Override
     public MethodInfo getMethodInfo(ELContext context) throws ELException {
-        return new MethodInfo(this.expr, this.expectedType, this.paramTypes);
+        context.notifyBeforeEvaluation(getExpressionString());
+        MethodInfo result =
+                new MethodInfo(this.expr, this.expectedType, this.paramTypes);
+        context.notifyAfterEvaluation(getExpressionString());
+        return result;
     }
 
     @Override
     public Object invoke(ELContext context, Object[] params) throws ELException {
+        context.notifyBeforeEvaluation(getExpressionString());
+        Object result;
         if (this.expectedType != null) {
-            return context.convertToType(this.expr, this.expectedType);
+            result = context.convertToType(this.expr, this.expectedType);
         } else {
-            return this.expr;
+            result = this.expr;
         }
+        context.notifyAfterEvaluation(getExpressionString());
+        return result;
     }
 
     @Override

Modified: tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java?rev=1502011&r1=1502010&r2=1502011&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java (original)
+++ tomcat/trunk/java/org/apache/el/ValueExpressionImpl.java Wed Jul 10 21:30:08 2013
@@ -168,7 +168,10 @@ public final class ValueExpressionImpl e
             ELException {
         EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
                 this.varMapper);
-        return this.getNode().getType(ctx);
+        context.notifyBeforeEvaluation(getExpressionString());
+        Class<?> result = this.getNode().getType(ctx);
+        context.notifyAfterEvaluation(getExpressionString());
+        return result;
     }
 
     /*
@@ -181,10 +184,12 @@ public final class ValueExpressionImpl e
             ELException {
         EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
                 this.varMapper);
+        context.notifyBeforeEvaluation(getExpressionString());
         Object value = this.getNode().getValue(ctx);
         if (this.expectedType != null) {
-            return context.convertToType(value, this.expectedType);
+            value = context.convertToType(value, this.expectedType);
         }
+        context.notifyAfterEvaluation(getExpressionString());
         return value;
     }
 
@@ -222,7 +227,10 @@ public final class ValueExpressionImpl e
             throws PropertyNotFoundException, ELException {
         EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
                 this.varMapper);
-        return this.getNode().isReadOnly(ctx);
+        context.notifyBeforeEvaluation(getExpressionString());
+        boolean result = this.getNode().isReadOnly(ctx);
+        context.notifyAfterEvaluation(getExpressionString());
+        return result;
     }
 
     @Override
@@ -249,7 +257,9 @@ public final class ValueExpressionImpl e
             ELException {
         EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
                 this.varMapper);
+        context.notifyBeforeEvaluation(getExpressionString());
         this.getNode().setValue(ctx, value);
+        context.notifyAfterEvaluation(getExpressionString());
     }
 
     @Override
@@ -273,7 +283,9 @@ public final class ValueExpressionImpl e
     public ValueReference getValueReference(ELContext context) {
         EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
                 this.varMapper);
-        return this.getNode().getValueReference(ctx);
+        context.notifyBeforeEvaluation(getExpressionString());
+        ValueReference result = this.getNode().getValueReference(ctx);
+        context.notifyAfterEvaluation(getExpressionString());
+        return result;
     }
-
 }

Modified: tomcat/trunk/java/org/apache/el/ValueExpressionLiteral.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/ValueExpressionLiteral.java?rev=1502011&r1=1502010&r2=1502011&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/el/ValueExpressionLiteral.java (original)
+++ tomcat/trunk/java/org/apache/el/ValueExpressionLiteral.java Wed Jul 10 21:30:08 2013
@@ -49,26 +49,37 @@ public final class ValueExpressionLitera
 
     @Override
     public Object getValue(ELContext context) {
+        context.notifyBeforeEvaluation(getExpressionString());
+        Object result;
         if (this.expectedType != null) {
-            return context.convertToType(this.value, this.expectedType);
+            result = context.convertToType(this.value, this.expectedType);
+        } else {
+            result = this.value;
         }
-        return this.value;
+        context.notifyAfterEvaluation(getExpressionString());
+        return result;
     }
 
     @Override
     public void setValue(ELContext context, Object value) {
+        context.notifyBeforeEvaluation(getExpressionString());
         throw new PropertyNotWritableException(MessageFactory.get(
                 "error.value.literal.write", this.value));
     }
 
     @Override
     public boolean isReadOnly(ELContext context) {
+        context.notifyBeforeEvaluation(getExpressionString());
+        context.notifyAfterEvaluation(getExpressionString());
         return true;
     }
 
     @Override
     public Class<?> getType(ELContext context) {
-        return (this.value != null) ? this.value.getClass() : null;
+        context.notifyBeforeEvaluation(getExpressionString());
+        Class<?> result = (this.value != null) ? this.value.getClass() : null;
+        context.notifyAfterEvaluation(getExpressionString());
+        return result;
     }
 
     @Override

Modified: tomcat/trunk/java/org/apache/jasper/el/JspMethodExpression.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/el/JspMethodExpression.java?rev=1502011&r1=1502010&r2=1502011&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/el/JspMethodExpression.java (original)
+++ tomcat/trunk/java/org/apache/jasper/el/JspMethodExpression.java Wed Jul 10 21:30:08 2013
@@ -48,8 +48,11 @@ public final class JspMethodExpression e
     public MethodInfo getMethodInfo(ELContext context)
             throws NullPointerException, PropertyNotFoundException,
             MethodNotFoundException, ELException {
+        context.notifyBeforeEvaluation(getExpressionString());
         try {
-            return this.target.getMethodInfo(context);
+            MethodInfo result = this.target.getMethodInfo(context);
+            context.notifyAfterEvaluation(getExpressionString());
+            return result;
         } catch (MethodNotFoundException e) {
             if (e instanceof JspMethodNotFoundException) throw e;
             throw new JspMethodNotFoundException(this.mark, e);
@@ -66,8 +69,11 @@ public final class JspMethodExpression e
     public Object invoke(ELContext context, Object[] params)
             throws NullPointerException, PropertyNotFoundException,
             MethodNotFoundException, ELException {
+        context.notifyBeforeEvaluation(getExpressionString());
         try {
-            return this.target.invoke(context, params);
+            Object result = this.target.invoke(context, params);
+            context.notifyAfterEvaluation(getExpressionString());
+            return result;
         } catch (MethodNotFoundException e) {
             if (e instanceof JspMethodNotFoundException) throw e;
             throw new JspMethodNotFoundException(this.mark, e);

Modified: tomcat/trunk/java/org/apache/jasper/el/JspValueExpression.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/el/JspValueExpression.java?rev=1502011&r1=1502010&r2=1502011&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/el/JspValueExpression.java (original)
+++ tomcat/trunk/java/org/apache/jasper/el/JspValueExpression.java Wed Jul 10 21:30:08 2013
@@ -56,8 +56,11 @@ public final class JspValueExpression ex
     @Override
     public Class<?> getType(ELContext context) throws NullPointerException,
             PropertyNotFoundException, ELException {
+        context.notifyBeforeEvaluation(getExpressionString());
         try {
-            return this.target.getType(context);
+            Class<?> result = this.target.getType(context);
+            context.notifyAfterEvaluation(getExpressionString());
+            return result;
         } catch (PropertyNotFoundException e) {
             if (e instanceof JspPropertyNotFoundException) throw e;
             throw new JspPropertyNotFoundException(this.mark, e);
@@ -70,8 +73,11 @@ public final class JspValueExpression ex
     @Override
     public boolean isReadOnly(ELContext context) throws NullPointerException,
             PropertyNotFoundException, ELException {
+        context.notifyBeforeEvaluation(getExpressionString());
         try {
-            return this.target.isReadOnly(context);
+            boolean result = this.target.isReadOnly(context);
+            context.notifyAfterEvaluation(getExpressionString());
+            return result;
         } catch (PropertyNotFoundException e) {
             if (e instanceof JspPropertyNotFoundException) throw e;
             throw new JspPropertyNotFoundException(this.mark, e);
@@ -85,8 +91,10 @@ public final class JspValueExpression ex
     public void setValue(ELContext context, Object value)
             throws NullPointerException, PropertyNotFoundException,
             PropertyNotWritableException, ELException {
+        context.notifyBeforeEvaluation(getExpressionString());
         try {
             this.target.setValue(context, value);
+            context.notifyAfterEvaluation(getExpressionString());
         } catch (PropertyNotWritableException e) {
             if (e instanceof JspPropertyNotWritableException) throw e;
             throw new JspPropertyNotWritableException(this.mark, e);
@@ -102,8 +110,11 @@ public final class JspValueExpression ex
     @Override
     public Object getValue(ELContext context) throws NullPointerException,
             PropertyNotFoundException, ELException {
+        context.notifyBeforeEvaluation(getExpressionString());
         try {
-            return this.target.getValue(context);
+            Object result = this.target.getValue(context);
+            context.notifyAfterEvaluation(getExpressionString());
+            return result;
         } catch (PropertyNotFoundException e) {
             if (e instanceof JspPropertyNotFoundException) throw e;
             throw new JspPropertyNotFoundException(this.mark, e);



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org