1 28 29 package com.caucho.el; 30 31 import com.caucho.loader.EnvironmentClassLoader; 32 33 import javax.el.ELContext; 34 import javax.el.ELResolver; 35 36 39 public class EnvironmentResolver extends AbstractVariableResolver { 40 private ClassLoader _loader; 41 42 45 public EnvironmentResolver(ClassLoader loader, ELResolver parent) 46 { 47 super(parent); 48 49 _loader = loader; 50 } 51 52 55 public Object getValue(ELContext context, 56 Object base, 57 Object property) 58 { 59 String var = (String ) base; 60 61 for (ClassLoader loader = _loader; 62 loader != null; 63 loader = loader.getParent()) { 64 if (loader instanceof EnvironmentClassLoader) { 65 Object value = EL.getLevelVar(var, loader); 66 67 if (value == EL.NULL) 68 return null; 69 else if (value != null) 70 return value; 71 } 72 } 73 74 Object value = EL.getLevelVar(var, null); 75 76 if (value == EL.NULL) 77 return null; 78 else if (value != null) 79 return value; 80 else 81 return super.getValue(context, var, property); 82 } 83 } 84 | Popular Tags |