https://bz.apache.org/bugzilla/show_bug.cgi?id=67080

--- Comment #17 from Christopher Schultz <ch...@christopherschultz.net> ---
Fair enough, but if we are going to try to squeeze as much performance out of
this, then the correct process is with delegated dispatch:

enum Scope {
  applicationScope(0) {
    public Object getScopedValue(ELContext ctx, Object base, Object property) {
      PageContext page =  (PageContext) context
           .getContext(JspContext.class);
      context.setPropertyResolved(base, property);

      return ScopeManager.get(page).getApplicationScope();
    }
  },

  cookie(1) {
    public Object getScopedValue(ELContext ctx, Object base, Object property) {
      PageContext page =  (PageContext) context
           .getContext(JspContext.class);
      context.setPropertyResolved(base, property);

      return ScopeManager.get(page).getCookie();
    }
  },

  ...
}

Then:

Scope scope = Scope.valueOf(property);
if(null != scope) {
  return scope.getScopedValue(ctx, base, property);
} else {
  return null;
}

If you are going to perform a lookup, make sure you get the best bang for your
buck.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to