el-next@uel.java.net

Re: Intercepting EL Expression Evaluation

From: Lincoln Baxter, III <lincolnbaxter_at_gmail.com>
Date: Sun, 11 Apr 2010 15:05:59 -0400

+1

This will be fabulous -- hooks for decorators and interceptors here.

On Fri, Apr 9, 2010 at 10:01 AM, Pete Muir <pmuir_at_redhat.com> wrote:

> Any CDI based bean container will likely need to do this - if you take a
> look Section 6.4 of the CDI spec:
>
> "all @Dependent scoped contextual instances created during evaluation of a
> Unified EL expression in a JSP or JSF page are destroyed when the evaluation
> completes."
>
> You can see that we have a need to know when an expression starts to be
> evaluated (so that we can start collecting the dependent objects) and stops
> being evaluated (so that we can destroy the dependent objects). We also need
> a add stuff to the collection as the expression evaluates (for which the
> ELContext.putContext() method is ideal). So, IOW we have three requirements:
>
> * be notified when an expression evaluation starts
> * be notified when an expression evaluation ends
> * have the ELContext used for expression evaluation be made available as
> part of the notification.
>
> As starting point, we could add an interface like:
>
> interface ExpressionEvaluationCallback {
>
> void beforeEvaluation(ELContext ctx);
> void afterEvaluation(ELContext ctx);
>
> }
>
> However, IMO, a better (more powerful, fits well with the interceptors
> spec) is reuse the approach there whereby an interceptor method is annotated
> @AroundInvoke, and takes an argument of type InvocationContext, which allows
> access to contextual objects such as (in our case) ELContext, and also has a
> proceed() method which can be used to call the original object (in our case
> the built in evaluation).
>
> Thoughts?
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: el-next-unsubscribe_at_uel.dev.java.net
> For additional commands, e-mail: el-next-help_at_uel.dev.java.net
>
>


-- 
Lincoln Baxter, III
http://ocpsoft.com
http://scrumshark.com
"Keep it Simple"