Java Code Examples for javax.el.ELContext#setPropertyResolved()
The following examples show how to use
javax.el.ELContext#setPropertyResolved() .
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 Tomcat7.0.67 with Apache License 2.0 | 6 votes |
@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: ImplicitObjectELResolver.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings({ "unchecked", "rawtypes" }) // TCK signature test fails with generics public Class getType(ELContext context, Object base, Object property) throws NullPointerException, PropertyNotFoundException, 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); } } return null; }
Example 3
Source File: SpringBeanFacesELResolver.java From spring-analysis-note with MIT License | 6 votes |
@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 4
Source File: SpringBeanELResolver.java From lams with GNU General Public License v2.0 | 6 votes |
@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 5
Source File: ELResolverImpl.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
@Override public Object getValue(ELContext context, Object base, Object property) throws NullPointerException, PropertyNotFoundException, ELException { if (context == null) { throw new NullPointerException(); } if (base == null) { context.setPropertyResolved(true); 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; }
Example 6
Source File: ImplicitObjectELResolver.java From tomcatsrc with Apache License 2.0 | 6 votes |
@Override @SuppressWarnings({ "unchecked", "rawtypes" }) // TCK signature test fails with generics public Class getType(ELContext context, Object base, Object property) throws NullPointerException, PropertyNotFoundException, 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); } } return null; }
Example 7
Source File: DynamicBeanPropertyELResolver.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Override public Object getValue(ELContext context, Object base, Object property) { if (base == null || this.getCommonPropertyType(context, base) == null) { return null; } String propertyName = property.toString(); try { Object value = ReflectUtil.invoke(base, this.readMethodName, new Object[] { propertyName }); context.setPropertyResolved(true); return value; } catch (Exception e) { throw new ELException(e); } }
Example 8
Source File: ImplicitObjectELResolver.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Override public boolean isReadOnly(ELContext context, Object base, Object property) { Objects.requireNonNull(context); if (base == null && property != null) { int idx = Arrays.binarySearch(SCOPE_NAMES, property.toString()); if (idx >= 0) { context.setPropertyResolved(base, property); return true; } } return false; }
Example 9
Source File: WebApplicationContextFacesELResolver.java From spring-analysis-note with MIT License | 5 votes |
@Override public boolean isReadOnly(ELContext elContext, Object base, Object property) throws ELException { if (base instanceof WebApplicationContext) { elContext.setPropertyResolved(true); return true; } return false; }
Example 10
Source File: JasperELResolver.java From tomcatsrc with Apache License 2.0 | 5 votes |
@Override public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) { String targetMethod = coerceToString(method); if (targetMethod.length() == 0) { throw new ELException(new NoSuchMethodException()); } context.setPropertyResolved(false); Object result = null; // skip implicit and call app resolvers int index = 1 /* implicit */ + appResolversSize; for (int i = 1; i < index; i++) { result = resolvers[i].invoke( context, base, targetMethod, paramTypes, params); if (context.isPropertyResolved()) { return result; } } // skip map, resource, list, and array resolvers index += 4; // call bean and the rest of resolvers for (int i = index; i < size; i++) { result = resolvers[i].invoke( context, base, targetMethod, paramTypes, params); if (context.isPropertyResolved()) { return result; } } return null; }
Example 11
Source File: JasperELResolver.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
@Override public Object invoke(ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params) { String targetMethod = coerceToString(method); if (targetMethod.length() == 0) { throw new ELException(new NoSuchMethodException()); } context.setPropertyResolved(false); Object result = null; // skip implicit and call app resolvers int index = 1 /* implicit */ + appResolversSize; for (int i = 1; i < index; i++) { result = resolvers[i].invoke( context, base, targetMethod, paramTypes, params); if (context.isPropertyResolved()) { return result; } } // skip map, resource, list, and array resolvers index += 4; // call bean and the rest of resolvers for (int i = index; i < size; i++) { result = resolvers[i].invoke( context, base, targetMethod, paramTypes, params); if (context.isPropertyResolved()) { return result; } } return null; }
Example 12
Source File: JasperELResolver.java From tomcatsrc with Apache License 2.0 | 5 votes |
@Override public Object getValue(ELContext context, Object base, Object property) throws NullPointerException, PropertyNotFoundException, ELException { context.setPropertyResolved(false); int start; Object result = null; if (base == null) { // call implicit and app resolvers int index = 1 /* implicit */ + appResolversSize; for (int i = 0; i < index; i++) { result = resolvers[i].getValue(context, base, property); if (context.isPropertyResolved()) { return result; } } // skip collection-based resolvers (map, resource, list, array, and // bean) start = index + 5; } else { // skip implicit resolver only start = 1; } for (int i = start; i < size; i++) { result = resolvers[i].getValue(context, base, property); if (context.isPropertyResolved()) { return result; } } return null; }
Example 13
Source File: NodeELResolver.java From scipio-erp with Apache License 2.0 | 5 votes |
@Override public boolean isReadOnly(ELContext context, Object base, Object property) { if (context == null) { throw new NullPointerException("context is null"); } if (isResolvable(base)) { context.setPropertyResolved(true); } return true; }
Example 14
Source File: BlueprintContextELResolver.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public Object getValue(ELContext context, Object base, Object property) { if (base == null) { // according to javadoc, can only be a String String key = (String) property; for (String componentId : (Set<String>) blueprintContainer.getComponentIds()) { if (componentId.equals(key)) { context.setPropertyResolved(true); return blueprintContainer.getComponentInstance(key); } } } return null; }
Example 15
Source File: SpringBeanELResolver.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Class<?> getType(ELContext elContext, Object base, Object property) throws ELException { if (base == null) { String beanName = property.toString(); BeanFactory bf = getBeanFactory(elContext); if (bf.containsBean(beanName)) { elContext.setPropertyResolved(true); return bf.getType(beanName); } } return null; }
Example 16
Source File: JinjavaInterpreterResolver.java From jinjava with Apache License 2.0 | 5 votes |
@Override public Object invoke( ELContext context, Object base, Object method, Class<?>[] paramTypes, Object[] params ) { try { Object methodProperty = getValue(context, base, method, false); if (methodProperty instanceof AbstractCallableMethod) { context.setPropertyResolved(true); return interpreter.getContext().isValidationMode() ? "" : ((AbstractCallableMethod) methodProperty).evaluate(params); } } catch (IllegalArgumentException e) { // failed to access property, continue with method calls } return interpreter.getContext().isValidationMode() ? "" : super.invoke( context, base, method, paramTypes, generateMethodParams(method, params) ); }
Example 17
Source File: WebApplicationContextFacesELResolver.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Class<?> getType(ELContext elContext, 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; }
Example 18
Source File: WebApplicationContextFacesELResolver.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public Object getValue(ELContext elContext, 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; }
Example 19
Source File: ImplicitObjectELResolver.java From lams with GNU General Public License v2.0 | 4 votes |
/** * If the base object is <code>null</code>, and the property matches * the name of a JSP implicit object, returns <code>null</code> to * indicate that no types are ever accepted to <code>setValue()</code>. * * <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 to resolve. * @return If the <code>propertyResolved</code> property of * <code>ELContext</code> was set to <code>true</code>, then * <code>null</code>; otherwise undefined. * @throws NullPointerException if context is <code>null</code> * @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 Class getType(ELContext context, Object base, Object property) { 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)) { context.setPropertyResolved(true); } return null; }
Example 20
Source File: ManualScopeELResolver.java From JSF-on-Spring-Boot with GNU General Public License v3.0 | 3 votes |
@Override public Object getValue(final ELContext elContext, final Object base, final Object property) { if (property == null) { throw new PropertyNotFoundException(); } FacesContext facesContext = (FacesContext) elContext.getContext(FacesContext.class); if ((null == base) && ManualScope.SCOPE_NAME.equals(property.toString())) { // Scope is referenced directly ManualScope scope = getScope(facesContext); elContext.setPropertyResolved(true); return scope; } else if ((null != base) && (base instanceof ManualScope)) { // An object within the scope is referenced return resolve(facesContext, (ManualScope) base, property.toString()); } else if (null == base) { ManualScope customScope = getScope(facesContext); return null != customScope ? resolve(facesContext, customScope, property.toString()):null; } return null; }