Example usage for javax.el ELContext setPropertyResolved

List of usage examples for javax.el ELContext setPropertyResolved

Introduction

In this page you can find the example usage for javax.el ELContext setPropertyResolved.

Prototype

public void setPropertyResolved(boolean resolved) 

Source Link

Usage

From source file:org.springframework.web.jsf.el.SpringBeanFacesELResolver.java

public Object getValue(ELContext elContext, Object base, Object property) throws ELException {
    if (base == null) {
        // Ask Spring root application context.
        String beanName = property.toString();
        if (logger.isTraceEnabled()) {
            logger.trace("Attempting to resolve variable '" + beanName + "' in Spring ApplicationContext");
        }/*from ww w .  ja va  2 s.  c  om*/
        BeanFactory bf = getBeanFactory(elContext);
        if (bf.containsBean(beanName)) {
            if (logger.isDebugEnabled()) {
                logger.debug("Successfully resolved variable '" + beanName + "' in Spring ApplicationContext");
            }
            elContext.setPropertyResolved(true);
            return bf.getBean(beanName);
        }
    }

    return null;
}

From source file:org.springframework.web.jsf.el.SpringBeanFacesELResolver.java

public Class<?> getType(ELContext elContext, Object base, Object property) throws ELException {
    if (base == null) {
        // Ask Spring root application context.
        String name = property.toString();
        if (logger.isDebugEnabled()) {
            logger.debug("Attempting to resolve variable '" + name + "' in root WebApplicationContext");
        }/*from w w  w. j  a v a 2s .com*/
        BeanFactory bf = getBeanFactory(elContext);
        if (bf.containsBean(name)) {
            if (logger.isDebugEnabled()) {
                logger.debug("Successfully resolved variable '" + name + "' in root WebApplicationContext");
            }
            elContext.setPropertyResolved(true);
            return bf.getType(name);
        }
    }

    return null;
}

From source file:org.springframework.web.jsf.el.WebApplicationContextFacesELResolver.java

@Override
@Nullable/*from   w  w  w.  j ava  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/*w w  w.  j  ava  2 s  .  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.springframework.web.jsf.el.WebApplicationContextFacesELResolver.java

@Override
public boolean isReadOnly(ELContext elContext, Object base, Object property) throws ELException {
    if (base instanceof WebApplicationContext) {
        elContext.setPropertyResolved(true);
        return false;
    }//from w w w.  j  a v  a 2 s  .c o m
    return false;
}

From source file:org.springframework.webflow.expression.el.SpringBeanWebFlowELResolver.java

@Override
public void setValue(ELContext elContext, Object base, Object property, Object value) throws ELException {
    if (base == null) {
        String beanName = property.toString();
        BeanFactory bf = getBeanFactory(elContext);
        if (bf.containsBean(beanName)) {
            if (value == bf.getBean(beanName)) {
                // Setting the bean reference to the same value is alright - can simply be ignored...
                elContext.setPropertyResolved(true);
            } else {
                throw new PropertyNotWritableException("Variable '" + beanName + "' refers to "
                        + "a Spring bean which by definition is not writable");
            }//from w  w w  . jav a  2s . com
        }
    }
}

From source file:therian.uelbox.HelperELResolver.java

@Override
public final void setValue(ELContext context, Object base, Object property, Object value) {
    State state = getOrCreateState(context, base);
    Validate.validState(base == state.tip && state.depth.intValue() == 0);
    state.result = afterSetValue(context, base, property);
    state.completion = Completion.YES;
    context.setPropertyResolved(true);
}