javax.el.PropertyNotWritableException Java Examples

The following examples show how to use javax.el.PropertyNotWritableException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImplicitObjectELResolver.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null && property != null) {
        int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
        if (idx >= 0) {
            context.setPropertyResolved(true);
            throw new PropertyNotWritableException();
        }
    }
}
 
Example #2
Source File: SpringBeanELResolver.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@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");
			}
		}
	}
}
 
Example #3
Source File: SpringBeanELResolver.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@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");
			}
		}
	}
}
 
Example #4
Source File: SpringBeanFacesELResolver.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Override
public void setValue(ELContext elContext, @Nullable Object base, Object property, Object value) throws ELException {
	if (base == null) {
		String beanName = property.toString();
		WebApplicationContext wac = getWebApplicationContext(elContext);
		if (wac.containsBean(beanName)) {
			if (value == wac.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");
			}
		}
	}
}
 
Example #5
Source File: SpringBeanFacesELResolver.java    From java-technology-stack with MIT License 6 votes vote down vote up
@Override
public void setValue(ELContext elContext, @Nullable Object base, Object property, Object value) throws ELException {
	if (base == null) {
		String beanName = property.toString();
		WebApplicationContext wac = getWebApplicationContext(elContext);
		if (wac.containsBean(beanName)) {
			if (value == wac.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");
			}
		}
	}
}
 
Example #6
Source File: ScopedAttributeELResolver.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            int scope = page.getAttributesScope(key);
            if (scope != 0) {
                page.setAttribute(key, value, scope);
            } else {
                page.setAttribute(key, value);
            }
        }
    }
}
 
Example #7
Source File: ELResolverImpl.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        throw new PropertyNotWritableException(
                "Legacy VariableResolver wrapped, not writable");
    }

    if (!context.isPropertyResolved()) {
        elResolver.setValue(context, base, property, value);
    }
}
 
Example #8
Source File: ImplicitObjectELResolver.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null && property != null) {
        int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
        if (idx >= 0) {
            context.setPropertyResolved(true);
            throw new PropertyNotWritableException();
        }
    }
}
 
Example #9
Source File: ScopedAttributeELResolver.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        if (property != null) {
            String key = property.toString();
            PageContext page = (PageContext) context
                    .getContext(JspContext.class);
            int scope = page.getAttributesScope(key);
            if (scope != 0) {
                page.setAttribute(key, value, scope);
            } else {
                page.setAttribute(key, value);
            }
        }
    }
}
 
Example #10
Source File: ELResolverImpl.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) throws NullPointerException,
        PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    if (context == null) {
        throw new NullPointerException();
    }

    if (base == null) {
        context.setPropertyResolved(true);
        throw new PropertyNotWritableException(
                "Legacy VariableResolver wrapped, not writable");
    }

    if (!context.isPropertyResolved()) {
        elResolver.setValue(context, base, property, value);
    }
}
 
Example #11
Source File: ValueExpressionImpl.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(ELContext context, Object value)
        throws PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
            this.varMapper);
    this.getNode().setValue(ctx, value);
}
 
Example #12
Source File: NodeELResolver.java    From scipio-erp with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property, Object value) {
    if (context == null) {
        throw new NullPointerException("context is null");
    }
    if (isResolvable(base)) {
        throw new PropertyNotWritableException("resolver is read-only");
    }
}
 
Example #13
Source File: SpringBeanELResolver.java    From blog_demos with Apache License 2.0 5 votes vote down vote up
@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)) {
			throw new PropertyNotWritableException(
					"Variable '" + beanName + "' refers to a Spring bean which by definition is not writable");
		}
	}
}
 
Example #14
Source File: ValueExpressionImpl.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(ELContext context, Object value)
        throws PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
            this.varMapper);
    this.getNode().setValue(ctx, value);
}
 
Example #15
Source File: ImplicitObjectELResolver.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) {
    Objects.requireNonNull(context);

    if (base == null && property != null) {
        int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString());
        if (idx >= 0) {
            context.setPropertyResolved(base, property);
            throw new PropertyNotWritableException();
        }
    }
}
 
Example #16
Source File: ELResolverImpl.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property,
        Object value) {
    Objects.requireNonNull(context);

    if (base == null) {
        context.setPropertyResolved(base, property);
        throw new PropertyNotWritableException(
                "Legacy VariableResolver wrapped, not writable");
    }

    if (!context.isPropertyResolved()) {
        elResolver.setValue(context, base, property, value);
    }
}
 
Example #17
Source File: ValueExpressionImpl.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public void setValue(ELContext context, Object value)
        throws PropertyNotFoundException, PropertyNotWritableException,
        ELException {
    EvaluationContext ctx = new EvaluationContext(context, this.fnMapper,
            this.varMapper);
    context.notifyBeforeEvaluation(getExpressionString());
    this.getNode().setValue(ctx, value);
    context.notifyAfterEvaluation(getExpressionString());
}
 
Example #18
Source File: ValueExpressionLiteral.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(ELContext context, Object value) {
    throw new PropertyNotWritableException(MessageFactory.get(
            "error.value.literal.write", this.value));
}
 
Example #19
Source File: SimpleNode.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(EvaluationContext ctx, Object value)
        throws ELException {
    throw new PropertyNotWritableException(MessageFactory.get("error.syntax.set"));
}
 
Example #20
Source File: WebAppElResolver.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(final ELContext context, final Object base, final Object property, final Object value) throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException {
    // no-op
}
 
Example #21
Source File: JspPropertyNotWritableException.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
public JspPropertyNotWritableException(String mark, PropertyNotWritableException e) {
    super(mark + " " + e.getMessage(), e.getCause());
}
 
Example #22
Source File: ValueExpressionLiteral.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
@Override
public void setValue(ELContext context, Object value) {
    context.notifyBeforeEvaluation(getExpressionString());
    throw new PropertyNotWritableException(MessageFactory.get(
            "error.value.literal.write", this.value));
}
 
Example #23
Source File: UelUtil.java    From scipio-erp with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(ELContext context, Object value) {
    throw new PropertyNotWritableException();
}
 
Example #24
Source File: UelUtil.java    From scipio-erp with Apache License 2.0 4 votes vote down vote up
@Override
public ValueExpression setVariable(String variable, ValueExpression expression) {
    throw new PropertyNotWritableException();
}
 
Example #25
Source File: ImplicitObjectELResolver.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * If the base object is <code>null</code>, and the property matches
 * the name of a JSP implicit object, throws
 * <code>PropertyNotWritableException</code> to indicate that implicit
 * objects cannot be overwritten.
 *
 * <p>The <code>propertyResolved</code> property of the 
 * <code>ELContext</code> object must be set to <code>true</code> by 
 * this resolver before returning if an implicit object is matched. If 
 * this property is not <code>true</code> after this method is called,
 * the caller should ignore the return value.</p>
 *
 * @param context The context of this evaluation.
 * @param base Only <code>null</code> is handled by this resolver.
 *     Other values will result in an immediate return.
 * @param property The name of the implicit object.
 * @param val The value to be associated with the implicit object.
 * @throws NullPointerException if context is <code>null</code>.
 * @throws PropertyNotWritableException always thrown, if the 
 *     implicit object name is recognized by this resolver.
 * @throws ELException if an exception was thrown while performing
 *     the property or variable resolution. The thrown exception
 *     must be included as the cause property of this exception, if
 *     available.
 */
public void  setValue(ELContext context,
                      Object base,
                      Object property,
                      Object val) {

    if (context == null) {
        throw new NullPointerException();
    }

    if ((base == null) && ("pageContext".equals(property) || 
            "pageScope".equals(property)) ||
            "requestScope".equals(property) ||
            "sessionScope".equals(property) ||
            "applicationScope".equals (property) ||
            "param".equals (property) ||
            "paramValues".equals (property) ||
            "header".equals (property) ||
            "headerValues".equals (property) ||
            "initParam".equals (property) ||
            "cookie".equals (property)) {
        throw new PropertyNotWritableException();
    }
}
 
Example #26
Source File: JspPropertyNotWritableException.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
public JspPropertyNotWritableException(String mark, PropertyNotWritableException e) {
    super(mark + " " + e.getMessage(), e.getCause());
}
 
Example #27
Source File: SimpleNode.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(EvaluationContext ctx, Object value)
        throws ELException {
    throw new PropertyNotWritableException(MessageFactory.get("error.syntax.set"));
}
 
Example #28
Source File: ValueExpressionLiteral.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(ELContext context, Object value) {
    throw new PropertyNotWritableException(MessageFactory.get(
            "error.value.literal.write", this.value));
}
 
Example #29
Source File: SimulationExpressionManager.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(ELContext context, Object base, Object property, Object value) {
  throw new PropertyNotWritableException("Variable '" + property + "' is not writable");
}
 
Example #30
Source File: JspPropertyNotWritableException.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
public JspPropertyNotWritableException(String mark, PropertyNotWritableException e) {
    super(mark + " " + e.getMessage(), e.getCause());
}