@Override public Object getValue(ELContext elContext, Object base, Object property) { if (EL_NAME.equals(property)) { elContext.setPropertyResolved(true); FacesContext context = FacesContext.getCurrentInstance(); ExceptionInfo info = (ExceptionInfo) context.getAttributes().get(ExceptionInfo.ATTRIBUTE_NAME); if (info == null) { info = (ExceptionInfo) context.getExternalContext().getSessionMap().get(ExceptionInfo.ATTRIBUTE_NAME); } return info; } return null; }
boolean propertyResolvedSave = isPropertyResolved(); try { setPropertyResolved(false); ELResolver elResolver = getELResolver(); if (elResolver != null) { Object res = elResolver.convertToType(this, obj, targetType); if (isPropertyResolved()) { return res; throw ex; } catch (Exception ex) { throw new ELException(ex); } finally { setPropertyResolved(propertyResolvedSave);
context.setPropertyResolved(true); if (property instanceof String) { String attribute = (String) property; PageContext ctxt = (PageContext) context.getContext(JspContext.class); return ctxt.findAttribute(attribute);
/** * Converts an object to a specific type. * * <p>An <code>ELException</code> is thrown if an error occurs during * the conversion.</p> * * @param context The context of this evaluation. * @param obj The object to convert. * @param targetType The target type for the convertion. * @throws ELException thrown if errors occur. * * @since EL 3.0 */ @Override public Object convertToType(ELContext context, Object obj, Class<?> targetType) { context.setPropertyResolved(false); Object value = null; for (int i = 0; i < size; i++) { value = elResolvers[i].convertToType(context, obj, targetType); if (context.isPropertyResolved()) { return value; } } return null; }
Object val) { context.setPropertyResolved(false); elResolvers[i].setValue(context, base, property, val); if (context.isPropertyResolved()) { return;
Object property) { context.setPropertyResolved(false); value = elResolvers[i].getValue(context, base, property); if (context.isPropertyResolved()) { return value;
public Object getValue(ELContext context, Object base, Object property) throws ELException { if (base != null) { return null; } if ( property == null) { String message = MessageUtils.getExceptionMessageString (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "base and property"); // ????? throw new PropertyNotFoundException(message); } context.setPropertyResolved(true); String attribute = property.toString(); FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class); ExternalContext ec = facesContext.getExternalContext(); Object result; if (null == (result = ec.getRequestMap().get(attribute))) { if (null == (result = ec.getSessionMap().get(attribute))) { result = ec.getApplicationMap().get(attribute); } } return result; }
public Object getValue(ELContext context, Object base, Object property) { if (null != base) { return null; } if (null == property) { String message = MessageUtils.getExceptionMessageString (MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "base and property"); // ????? throw new PropertyNotFoundException(message); } FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class); Application app = facesContext.getApplication(); ResourceBundle result = app.getResourceBundle(facesContext, property.toString()); if (null != result) { context.setPropertyResolved(true); } return result; }
public void contextCreated(ELContextEvent ece) { FacesContext facesContext = FacesContext.getCurrentInstance(); if (facesContext != null) { ece.getELContext().putContext(FacesContext.class, facesContext); for (ELContextListener listener : facesContext.getApplication().getELContextListeners()) { listener.contextCreated(ece); } } }
public void setValue(Bindings bindings, ELContext context, Object value) throws ELException { if (!lvalue) { throw new ELException(LocalMessages.get("error.value.set.rvalue", getStructuralId(bindings))); } Object base = prefix.eval(bindings, context); if (base == null) { throw new PropertyNotFoundException(LocalMessages.get("error.property.base.null", prefix)); } Object property = getProperty(bindings, context); if (property == null && strict) { throw new PropertyNotFoundException(LocalMessages.get("error.property.property.notfound", "null", base)); } context.setPropertyResolved(false); Class<?> type = context.getELResolver().getType(context, base, property); if (context.isPropertyResolved()) { if (type != null && (value != null || type.isPrimitive())) { value = bindings.convert(value, type); } context.setPropertyResolved(false); } context.getELResolver().setValue(context, base, property, value); if (!context.isPropertyResolved()) { throw new PropertyNotFoundException(LocalMessages.get("error.property.property.notfound", property, base)); } }
@Override public Object getValue(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base == null) { context.setPropertyResolved(base, property); if (property != null) { try { return this.variableResolver.resolveVariable(property .toString()); } catch (javax.servlet.jsp.el.ELException e) { throw new ELException(e.getMessage(), e.getCause()); } } } if (!context.isPropertyResolved()) { return elResolver.getValue(context, base, property); } return null; }
public boolean isReadOnly(ELContext context) { Object base = this.orig.getValue(context); if (base != null) { context.setPropertyResolved(false); return context.getELResolver().isReadOnly(context, base, i); } return true; }
Method method = bp.getReadMethod(); if (method == null) { throw new PropertyNotFoundException( ELUtil.getExceptionMessageString(context, "propertyNotReadable", try { value = method.invoke(base, new Object[0]); context.setPropertyResolved(base, property); } catch (ELException ex) { throw ex; } catch (InvocationTargetException ite) { throw new ELException(ite.getCause()); } catch (Exception ex) { throw new ELException(ex);
/** * <p>Evaluate this expression relative to the specified context, * and return the result.</p> * * @param context ELContext for this evaluation */ public Object getValue(ELContext context) { if (context == null) { throw new NullPointerException(); } FacesContext fcontext = (FacesContext) context.getContext(FacesContext.class); return fcontext.getApplication().getExpressionFactory().coerceToType(instance, expectedType); }
logger.debug("Successfully resolved property '" + beanName + "' in root WebApplicationContext"); elContext.setPropertyResolved(true); try { return wac.getType(beanName); throw new ELException(ex); elContext.setPropertyResolved(true); return WebApplicationContext.class;
public Object getValue(ELContext context) { Object base = this.orig.getValue(context); if (base != null) { context.setPropertyResolved(false); return context.getELResolver().getValue(context, base, i); } return null; }
@Override public Class<?> getType(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base == null) { context.setPropertyResolved(base, property); if (property != null) { try { Object obj = this.variableResolver.resolveVariable(property .toString()); return (obj != null) ? obj.getClass() : null; } catch (javax.servlet.jsp.el.ELException e) { throw new ELException(e.getMessage(), e.getCause()); } } } if (!context.isPropertyResolved()) { return elResolver.getType(context, base, property); } return null; }
public void beforePhase(final PhaseEvent event) { //force the creation of 'icefacesBeanDestroyRecorder' bean FacesContext context = FacesContext.getCurrentInstance(); ELContext elContext = context.getELContext(); elContext.getELResolver().getValue(elContext, null, ICEFACES_BEAN_DESTROY_RECORDER); }
public void setValue(ELContext context, Object value) { Object base = this.orig.getValue(context); if (base != null) { context.setPropertyResolved(false); context.getELResolver().setValue(context, base, i, value); } }
public Class getType(ELContext context) { Object base = this.orig.getValue(context); if (base != null) { context.setPropertyResolved(false); return context.getELResolver().getType(context, base, i); } return null; }