public CompositeELResolverImpl() { add(new ScopeELResolver()); add(new TilesContextELResolver(new TilesContextBeanELResolver())); add(new TilesContextBeanELResolver()); add(new ArrayELResolver(false)); add(new ListELResolver(false)); add(new MapELResolver(false)); add(new ResourceBundleELResolver()); add(new BeanELResolver(false)); } }
/** {@inheritDoc} */ @Override public Object getValue(ELContext context, Object base, Object property) { if (base != null) { return null; } Object retValue = findObjectByProperty(context, property); if (retValue != null) { context.setPropertyResolved(true); } return retValue; }
/** {@inheritDoc} */ @Override public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) { List<FeatureDescriptor> list = new ArrayList<FeatureDescriptor>(); Request request = (Request) context .getContext(Request.class); for (String scope : request.getAvailableScopes()) { collectBeanInfo(request.getContext(scope), list); } return list.iterator(); }
/** * Finds an object in request, session or application scope, in this order. * * @param context The context to use. * @param property The property used as an attribute name. * @return The found bean, if it exists, or <code>null</code> otherwise. * @since 2.2.1 */ protected Object findObjectByProperty(ELContext context, Object property) { Object retValue = null; Request request = (Request) context .getContext(Request.class); String prop = property.toString(); String[] scopes = request.getAvailableScopes().toArray(new String[0]); int i = 0; do { retValue = getObject(request.getContext(scopes[i]), prop); i++; } while (retValue == null && i < scopes.length); return retValue; }
/** {@inheritDoc} */ @Override public Class<?> getType(ELContext context, Object base, Object property) { if (base != null) { return null; } Object obj = findObjectByProperty(context, property); if (obj != null) { context.setPropertyResolved(true); return obj.getClass(); } return null; }
public CompositeELResolverImpl() { add(new ScopeELResolver()); add(new TilesContextELResolver(new TilesContextBeanELResolver())); add(new TilesContextBeanELResolver()); add(new ArrayELResolver(false)); add(new ListELResolver(false)); add(new MapELResolver(false)); add(new ResourceBundleELResolver()); add(new BeanELResolver(false)); } }
public CompositeELResolverImpl() { TilesContextBeanELResolver resolver = new TilesContextBeanELResolver(); add(new TilesContextELResolver(resolver)); add(resolver); add(new ArrayELResolver(false)); add(new ListELResolver(false)); add(new MapELResolver(false)); add(new ResourceBundleELResolver()); add(new BeanELResolver(false)); } }
protected ELAttributeEvaluator createELEvaluator(ApplicationContext applicationContext) { if (JspFactory.getDefaultFactory() == null) { LOG.warn("JspFactory.getDefaultFactory returned null, EL support will be disabled"); return null; } ELAttributeEvaluator evaluator = new ELAttributeEvaluator(); JspExpressionFactoryFactory efFactory = new JspExpressionFactoryFactory(); efFactory.setApplicationContext(applicationContext); evaluator.setExpressionFactory(efFactory.getExpressionFactory()); ELResolver elResolver = new CompositeELResolver() { { BeanELResolver beanElResolver = new BeanELResolver(false); add(new ScopeELResolver()); add(new TilesContextELResolver(beanElResolver)); add(new TilesContextBeanELResolver()); add(new ArrayELResolver(false)); add(new ListELResolver(false)); add(new MapELResolver(false)); add(new ResourceBundleELResolver()); add(beanElResolver); } }; evaluator.setResolver(elResolver); return evaluator; }
/** * Creates the EL evaluator. * * @param applicationContext The Tiles application context. * @return The EL evaluator. */ private ELAttributeEvaluator createELEvaluator(ApplicationContext applicationContext) { ELAttributeEvaluator evaluator = new ELAttributeEvaluator(); JspExpressionFactoryFactory efFactory = new JspExpressionFactoryFactory(); efFactory.setApplicationContext(applicationContext); evaluator.setExpressionFactory(efFactory.getExpressionFactory()); ELResolver elResolver = new CompositeELResolver() { { BeanELResolver beanElResolver = new BeanELResolver(false); add(new ScopeELResolver()); add(new TilesContextELResolver(beanElResolver)); add(new TilesContextBeanELResolver()); add(new ArrayELResolver(false)); add(new ListELResolver(false)); add(new MapELResolver(false)); add(new ResourceBundleELResolver()); add(beanElResolver); } }; evaluator.setResolver(elResolver); return evaluator; }