List of usage examples for javax.el ELException ELException
public ELException(Throwable cause)
From source file:org.jbuilt.utils.ValueClosureExpression.java
@Override public Object getValue(ELContext elContext) throws ELException { this.elContext = elContext; if (elContext == null) { throw new NullPointerException("ELContext -> null"); }//w w w .j a v a 2 s.c om Object result = null; assert null != context; try { result = PropertyUtils.getProperty(bean, prop); } catch (Throwable e) { throw new ELException(e); } return result; }
From source file:org.jbuilt.utils.ValueClosureExpression.java
@Override public void setValue(ELContext elContext, Object value) throws ELException { if (elContext == null) { throw new NullPointerException("ELContext -> null"); }//ww w .j a v a 2s . co m assert null != context; try { PropertyUtils.setProperty(bean, prop, ((ValueClosureExpression) value).getValue()); } catch (Throwable e) { throw new ELException(e); } }
From source file:org.jbuilt.utils.ValueClosureExpression.java
@Override public boolean isReadOnly(ELContext elContext) throws ELException { if (elContext == null) { throw new NullPointerException("ELContext -> null"); }/*from ww w . j a v a 2 s. c om*/ boolean result = false; assert null != context; try { result = isReadOnly(bean, prop); } catch (Throwable e) { throw new ELException(e); } return result; }
From source file:org.jbuilt.utils.ValueClosureExpression.java
@Override public Class<?> getType(ELContext elContext) throws ELException { if (elContext == null) { throw new NullPointerException("ELContext -> null"); }/* w w w . j a v a2s .com*/ Class result = null; assert null != context; try { result = getType(this.bean, this.prop); } catch (Throwable e) { throw new ELException(e); } return result; }
From source file:org.nuxeo.ecm.platform.ui.web.binding.MetaMethodExpression.java
@Override public Object invoke(ELContext context, Object[] params) { Object res = null;/*w w w . j av a2 s . c o m*/ if (originalMethodExpression != null) { res = originalMethodExpression.invoke(context, params); if (res instanceof String) { String expression = (String) res; if (ComponentTagUtils.isValueReference(expression)) { FacesContext faces = FacesContext.getCurrentInstance(); Application app = faces.getApplication(); ExpressionFactory factory = app.getExpressionFactory(); MethodExpression newMeth = factory.createMethodExpression(context, expression, Object.class, new Class[0]); try { res = newMeth.invoke(context, null); } catch (Throwable t) { if (t instanceof InvocationTargetException) { // respect the javadoc contract of the overridden // method throw new ELException(t.getCause()); } else { throw new ELException(t); } } } else { res = expression; } } } return res; }
From source file:org.richfaces.taglib.ColumnsHandler.java
/** * Return expression for page variables/*from w w w . j av a 2s . co m*/ * * @param expr * @return */ private ValueExpression getVarExpression(FaceletContext ctx, ValueExpression expr/*, IterationContext itContext*/) { IterationContext itContext = getIterationContext(); Object o = expr.getValue(ctx.getFacesContext().getELContext()); int k = itContext._index; if (o.getClass().isArray() || o instanceof List) { return new IndexedValueExpression(expr, k); } if (o instanceof Collection || o instanceof Iterator || o instanceof Enumeration || o instanceof Map || o instanceof String) { if (itContext.iteratedExpression == null) { itContext.iteratedExpression = new IteratedExpression(expr, ","); } return new IteratedValueExpression(itContext.iteratedExpression, k); } throw new ELException("FOREACH_BAD_ITEMS"); }
From source file:org.richfaces.taglib.ColumnsTag.java
/** * Return expression for page variables/*ww w. jav a 2 s . c o m*/ * * @param expr * @return */ private ValueExpression getVarExpression(ValueExpression expr) { Object o = expr.getValue(pageContext.getELContext()); if (o.getClass().isArray() || o instanceof List) { return new IndexedValueExpression(__value, index); } if (o instanceof Collection || o instanceof Iterator || o instanceof Enumeration || o instanceof Map || o instanceof String) { if (iteratedExpression == null) { iteratedExpression = new IteratedExpression(__value, getDelims()); } return new IteratedValueExpression(iteratedExpression, index); } throw new ELException("FOREACH_BAD_ITEMS: [" + o.getClass().getName() + "] is not iterable item. Only [List, Array, Collection, Enumeration, Map, String] are supported."); }
From source file:org.springframework.web.jsf.el.WebApplicationContextFacesELResolver.java
@Override @Nullable//from w ww .ja va 2 s.c o m public Object getValue(ELContext elContext, @Nullable Object base, Object property) throws ELException { if (base != null) { if (base instanceof WebApplicationContext) { WebApplicationContext wac = (WebApplicationContext) base; String beanName = property.toString(); if (logger.isTraceEnabled()) { logger.trace("Attempting to resolve property '" + beanName + "' in root WebApplicationContext"); } if (wac.containsBean(beanName)) { if (logger.isDebugEnabled()) { logger.debug( "Successfully resolved property '" + beanName + "' in root WebApplicationContext"); } elContext.setPropertyResolved(true); try { return wac.getBean(beanName); } catch (BeansException ex) { throw new ELException(ex); } } else { // Mimic standard JSF/JSP behavior when base is a Map by returning null. return null; } } } else { if (WEB_APPLICATION_CONTEXT_VARIABLE_NAME.equals(property)) { elContext.setPropertyResolved(true); return getWebApplicationContext(elContext); } } return null; }
From source file:org.springframework.web.jsf.el.WebApplicationContextFacesELResolver.java
@Override @Nullable//from w ww . j ava 2s. c o m public Class<?> getType(ELContext elContext, @Nullable Object base, Object property) throws ELException { if (base != null) { if (base instanceof WebApplicationContext) { WebApplicationContext wac = (WebApplicationContext) base; String beanName = property.toString(); if (logger.isDebugEnabled()) { logger.debug("Attempting to resolve property '" + beanName + "' in root WebApplicationContext"); } if (wac.containsBean(beanName)) { if (logger.isDebugEnabled()) { logger.debug( "Successfully resolved property '" + beanName + "' in root WebApplicationContext"); } elContext.setPropertyResolved(true); try { return wac.getType(beanName); } catch (BeansException ex) { throw new ELException(ex); } } else { // Mimic standard JSF/JSP behavior when base is a Map by returning null. return null; } } } else { if (WEB_APPLICATION_CONTEXT_VARIABLE_NAME.equals(property)) { elContext.setPropertyResolved(true); return WebApplicationContext.class; } } return null; }
From source file:org.tinygroup.jspengine.runtime.PageContextImpl.java
/** * Evaluates an EL expression/*from w w w .j av a 2 s . c om*/ * * @param expression The expression to be evaluated * @param expectedType The expected resulting type * @param pageContext The page context * @param functionMap Maps prefix and name to Method * @return The result of the evaluation */ public static Object evaluateExpression(final String expression, final Class expectedType, final PageContext pageContext, final ProtectedFunctionMapper functionMap) throws ELException { Object retValue; if (SecurityUtil.isPackageProtectionEnabled()) { try { retValue = AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { ELContextImpl elContext = (ELContextImpl) pageContext.getELContext(); elContext.setFunctionMapper(functionMap); ExpressionFactory expFactory = getExpressionFactory(pageContext); ValueExpression expr = expFactory.createValueExpression(elContext, expression, expectedType); return expr.getValue(elContext); } }); } catch (PrivilegedActionException ex) { Exception realEx = ex.getException(); if (realEx instanceof ELException) { throw (ELException) realEx; } else { throw new ELException(realEx); } } } else { ELContextImpl elContext = (ELContextImpl) pageContext.getELContext(); elContext.setFunctionMapper(functionMap); ExpressionFactory expFactory = getExpressionFactory(pageContext); ValueExpression expr = expFactory.createValueExpression(elContext, expression, expectedType); retValue = expr.getValue(elContext); } return retValue; }