List of usage examples for javax.el ELContext getContext
public Object getContext(@SuppressWarnings("rawtypes") Class key)
From source file:org.apache.tiles.evaluator.el.TilesContextELResolver.java
/** {@inheritDoc} */ @Override/*from w ww . j a v a2s .co m*/ public Class<?> getType(ELContext context, Object base, Object property) { // only resolve at the root of the context if (base != null) { return null; } Class<?> retValue = null; if (requestProperties.contains(property)) { TilesRequestContext request = (TilesRequestContext) context.getContext(TilesRequestContext.class); retValue = super.getType(context, request, property); } else if (applicationProperties.contains(property)) { TilesApplicationContext applicationContext = (TilesApplicationContext) context .getContext(TilesApplicationContext.class); retValue = super.getType(context, applicationContext, property); } if (retValue != null) { context.setPropertyResolved(true); } return retValue; }
From source file:org.apache.tiles.evaluator.el.TilesContextELResolver.java
/** {@inheritDoc} */ @Override/*from w ww.j a v a2 s . co m*/ public Object getValue(ELContext context, Object base, Object property) { // only resolve at the root of the context if (base != null) { return null; } Object retValue = null; if (requestProperties.contains(property)) { TilesRequestContext request = (TilesRequestContext) context.getContext(TilesRequestContext.class); retValue = super.getValue(context, request, property); } else if (applicationProperties.contains(property)) { TilesApplicationContext applicationContext = (TilesApplicationContext) context .getContext(TilesApplicationContext.class); retValue = super.getValue(context, applicationContext, property); } if (retValue != null) { context.setPropertyResolved(true); } return retValue; }
From source file:org.nuxeo.ecm.platform.ui.web.binding.alias.AliasValueExpression.java
protected ValueExpression resolveExpression(ELContext context) { FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class); AliasVariableMapper vm = AliasVariableMapper.getVariableMapper(facesContext, id); if (vm == null) { if (log.isDebugEnabled()) { log.debug("No alias variable mapper with id '" + id + "' found in request for var '" + var + "'"); }//w w w . ja v a 2s.c om return null; } ValueExpression ve = vm.resolveVariable(var); if (ve == null) { log.error("Variable for var '" + var + "' not found in alias variable mapper with id '" + id + "'"); return null; } return ve; }
From source file:org.richfaces.taglib.ColumnsTag.java
/** * Create custom context with VariableMapper override. * /* ww w. j a v a 2 s.c o m*/ * @param context * @return */ private ELContext getContext(final ELContext cont) { return new ELContext() { @Override public Object getContext(Class key) { return cont.getContext(key); } @Override public ELResolver getELResolver() { return cont.getELResolver(); } @Override public FunctionMapper getFunctionMapper() { return cont.getFunctionMapper(); } @Override public VariableMapper getVariableMapper() { return new VariableMapper() { @Override public ValueExpression resolveVariable(String variable) { if (variable.equals(itemId)) { return new IndexedValueExpression(__value, index); } else if (variable.equals(indexId)) { return new IteratedIndexExpression(index); } return cont.getVariableMapper().resolveVariable(variable); } @Override public ValueExpression setVariable(String variable, ValueExpression expression) { return cont.getVariableMapper().setVariable(variable, expression); } }; } }; }