javax.el.BeanELResolver Java Examples
The following examples show how to use
javax.el.BeanELResolver.
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: JasperELResolver.java From Tomcat8-Source-Read with MIT License | 6 votes |
public JasperELResolver(List<ELResolver> appResolvers, ELResolver streamResolver) { appResolversSize = appResolvers.size(); resolvers = new ELResolver[appResolversSize + STANDARD_RESOLVERS_COUNT]; add(new ImplicitObjectELResolver()); for (ELResolver appResolver : appResolvers) { add(appResolver); } add(streamResolver); add(new StaticFieldELResolver()); add(new MapELResolver()); add(new ResourceBundleELResolver()); add(new ListELResolver()); add(new ArrayELResolver()); add(new BeanELResolver()); add(new ScopedAttributeELResolver()); }
Example #2
Source File: MyfacesTest.java From ysoserial with MIT License | 6 votes |
private static FacesContext createMockFacesContext () throws MalformedURLException { FacesContext ctx = Mockito.mock(FacesContext.class); CompositeELResolver cer = new CompositeELResolver(); FacesELContext elc = new FacesELContext(cer, ctx); ServletRequest requestMock = Mockito.mock(ServletRequest.class); ServletContext contextMock = Mockito.mock(ServletContext.class); URL url = new URL("file:///"); Mockito.when(contextMock.getResource(Matchers.anyString())).thenReturn(url); Mockito.when(requestMock.getServletContext()).thenReturn(contextMock); Answer<?> attrContext = new MockRequestContext(); Mockito.when(requestMock.getAttribute(Matchers.anyString())).thenAnswer(attrContext); Mockito.doAnswer(attrContext).when(requestMock).setAttribute(Matchers.anyString(), Matchers.any()); cer.add(new MockELResolver(requestMock)); cer.add(new BeanELResolver()); cer.add(new MapELResolver()); Mockito.when(ctx.getELContext()).thenReturn(elc); return ctx; }
Example #3
Source File: JasperELResolver.java From tomcatsrc with Apache License 2.0 | 6 votes |
public JasperELResolver(List<ELResolver> appResolvers) { appResolversSize = appResolvers.size(); resolvers = new ELResolver[appResolversSize + 7]; size = 0; add(new ImplicitObjectELResolver()); for (ELResolver appResolver : appResolvers) { add(appResolver); } add(new MapELResolver()); add(new ResourceBundleELResolver()); add(new ListELResolver()); add(new ArrayELResolver()); add(new BeanELResolver()); add(new ScopedAttributeELResolver()); }
Example #4
Source File: MyfacesTest.java From ysoserial-modified with MIT License | 6 votes |
private static FacesContext createMockFacesContext () throws MalformedURLException { FacesContext ctx = Mockito.mock(FacesContext.class); CompositeELResolver cer = new CompositeELResolver(); FacesELContext elc = new FacesELContext(cer, ctx); ServletRequest requestMock = Mockito.mock(ServletRequest.class); ServletContext contextMock = Mockito.mock(ServletContext.class); URL url = new URL("file:///"); Mockito.when(contextMock.getResource(Matchers.anyString())).thenReturn(url); Mockito.when(requestMock.getServletContext()).thenReturn(contextMock); Answer<?> attrContext = new MockRequestContext(); Mockito.when(requestMock.getAttribute(Matchers.anyString())).thenAnswer(attrContext); Mockito.doAnswer(attrContext).when(requestMock).setAttribute(Matchers.anyString(), Matchers.any()); cer.add(new MockELResolver(requestMock)); cer.add(new BeanELResolver()); cer.add(new MapELResolver()); Mockito.when(ctx.getELContext()).thenReturn(elc); return ctx; }
Example #5
Source File: JasperELResolver.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
public JasperELResolver(List<ELResolver> appResolvers) { appResolversSize = appResolvers.size(); resolvers = new ELResolver[appResolversSize + 7]; size = 0; add(new ImplicitObjectELResolver()); for (ELResolver appResolver : appResolvers) { add(appResolver); } add(new MapELResolver()); add(new ResourceBundleELResolver()); add(new ListELResolver()); add(new ArrayELResolver()); add(new BeanELResolver()); add(new ScopedAttributeELResolver()); }
Example #6
Source File: ExpressionManager.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
protected ELResolver createElResolver(VariableScope variableScope) { CompositeELResolver elResolver = new CompositeELResolver(); elResolver.add(new VariableScopeElResolver(variableScope)); if (beans != null) { // ACT-1102: Also expose all beans in configuration when using // standalone activiti, not // in spring-context elResolver.add(new ReadOnlyMapELResolver(beans)); } elResolver.add(new ArrayELResolver()); elResolver.add(new ListELResolver()); elResolver.add(new MapELResolver()); elResolver.add(new JsonNodeELResolver()); elResolver.add(new DynamicBeanPropertyELResolver(ItemInstance.class, "getFieldValue", "setFieldValue")); // TODO: needs verification elResolver.add(new BeanELResolver()); return elResolver; }
Example #7
Source File: ExpressionManager.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
protected ELResolver createElResolver(Map<String, Object> variables) { CompositeELResolver elResolver = new CompositeELResolver(); elResolver.add(new VariableElResolver(variables)); if (beans != null) { // ACT-1102: Also expose all beans in configuration when using // standalone activiti, not // in spring-context elResolver.add(new ReadOnlyMapELResolver(beans)); } elResolver.add(new ArrayELResolver()); elResolver.add(new ListELResolver()); elResolver.add(new MapELResolver()); elResolver.add(new JsonNodeELResolver()); elResolver.add(new BeanELResolver()); return elResolver; }
Example #8
Source File: SpringExpressionManager.java From activiti6-boot2 with Apache License 2.0 | 6 votes |
@Override protected ELResolver createElResolver(VariableScope variableScope) { CompositeELResolver compositeElResolver = new CompositeELResolver(); compositeElResolver.add(new VariableScopeElResolver(variableScope)); if (beans != null) { // Only expose limited set of beans in expressions compositeElResolver.add(new ReadOnlyMapELResolver(beans)); } else { // Expose full application-context in expressions compositeElResolver.add(new ApplicationContextElResolver(applicationContext)); } compositeElResolver.add(new ArrayELResolver()); compositeElResolver.add(new ListELResolver()); compositeElResolver.add(new MapELResolver()); compositeElResolver.add(new JsonNodeELResolver()); compositeElResolver.add(new BeanELResolver()); return compositeElResolver; }
Example #9
Source File: JuelElProvider.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected static ELResolver createDefaultResolver() { CompositeELResolver resolver = new CompositeELResolver(); resolver.add(new VariableContextElResolver()); resolver.add(new ArrayELResolver(true)); resolver.add(new ListELResolver(true)); resolver.add(new MapELResolver(true)); resolver.add(new ResourceBundleELResolver()); resolver.add(new BeanELResolver()); return resolver; }
Example #10
Source File: JuelScriptEngine.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
private ELResolver createElResolver() { CompositeELResolver compositeResolver = new CompositeELResolver(); compositeResolver.add(new ArrayELResolver()); compositeResolver.add(new ListELResolver()); compositeResolver.add(new MapELResolver()); compositeResolver.add(new JsonNodeELResolver()); compositeResolver.add(new ResourceBundleELResolver()); compositeResolver.add(new DynamicBeanPropertyELResolver(ItemInstance.class, "getFieldValue", "setFieldValue")); compositeResolver.add(new BeanELResolver()); return new SimpleResolver(compositeResolver); }
Example #11
Source File: ElMetricName.java From metrics-cdi with Apache License 2.0 | 5 votes |
ElMetricName(ELResolver resolver, ExpressionFactory expressionFactory, MetricsExtension extension) { super(extension); CompositeELResolver composite = new CompositeELResolver(); composite.add(resolver); composite.add(new MapELResolver()); composite.add(new ListELResolver()); composite.add(new ArrayELResolver()); composite.add(new ResourceBundleELResolver()); composite.add(new BeanELResolver(true)); this.elResolver = composite; this.expressionFactory = expressionFactory; }
Example #12
Source File: RuleEvaluator.java From proctor with Apache License 2.0 | 5 votes |
@Nonnull private static CompositeELResolver constructStandardElResolver() { final CompositeELResolver elResolver = new CompositeELResolver(); elResolver.add(new ArrayELResolver()); elResolver.add(new ListELResolver()); elResolver.add(new MapELResolver()); elResolver.add(new BeanELResolver()); // this must be last, because it throws Exception return elResolver; }
Example #13
Source File: ELContextImpl.java From Tomcat8-Source-Read with MIT License | 5 votes |
public static ELResolver getDefaultResolver(ExpressionFactory factory) { if (Constants.IS_SECURITY_ENABLED) { CompositeELResolver defaultResolver = new CompositeELResolver(); defaultResolver.add(factory.getStreamELResolver()); defaultResolver.add(new StaticFieldELResolver()); defaultResolver.add(new MapELResolver()); defaultResolver.add(new ResourceBundleELResolver()); defaultResolver.add(new ListELResolver()); defaultResolver.add(new ArrayELResolver()); defaultResolver.add(new BeanELResolver()); return defaultResolver; } else { return DefaultResolver; } }
Example #14
Source File: JuelElProvider.java From camunda-engine-dmn with Apache License 2.0 | 5 votes |
protected static ELResolver createDefaultResolver() { CompositeELResolver resolver = new CompositeELResolver(); resolver.add(new VariableContextElResolver()); resolver.add(new ArrayELResolver(true)); resolver.add(new ListELResolver(true)); resolver.add(new MapELResolver(true)); resolver.add(new ResourceBundleELResolver()); resolver.add(new BeanELResolver()); return resolver; }
Example #15
Source File: PageContextImpl.java From packagedrone with Eclipse Public License 1.0 | 5 votes |
private ELResolver getELResolver() { if (elResolver == null) { // Create a CompositeELResolver CompositeELResolver celResolver = new CompositeELResolver(); celResolver.add(new ImplicitObjectELResolver()); // Add ELResolvers registered in JspApplicationContext JspApplicationContextImpl jaContext = getJspApplicationContext(); Iterator<ELResolver> it = jaContext.getELResolvers(); while (it.hasNext()) { celResolver.add(it.next()); } ELResolver streamELResolver = getExpressionFactory(this).getStreamELResolver(); if (streamELResolver != null) { celResolver.add(streamELResolver); } celResolver.add(new StaticFieldELResolver()); celResolver.add(new MapELResolver()); celResolver.add(new ResourceBundleELResolver()); celResolver.add(new ListELResolver()); celResolver.add(new ArrayELResolver()); celResolver.add(new BeanELResolver()); celResolver.add(new ScopedAttributeELResolver()); elResolver = celResolver; } return elResolver; }
Example #16
Source File: TilesConfigurer.java From spring-analysis-note with MIT License | 5 votes |
public CompositeELResolverImpl() { add(new ScopeELResolver()); add(new TilesContextELResolver(new TilesContextBeanELResolver())); add(new TilesContextBeanELResolver()); add(new ArrayELResolver(false)); add(new ListELResolver(false)); add(new MapELResolver(false)); add(new ResourceBundleELResolver()); add(new BeanELResolver(false)); }
Example #17
Source File: ELContextImpl.java From tomcatsrc with Apache License 2.0 | 5 votes |
public static ELResolver getDefaultResolver() { if (Constants.IS_SECURITY_ENABLED) { CompositeELResolver defaultResolver = new CompositeELResolver(); defaultResolver.add(new MapELResolver()); defaultResolver.add(new ResourceBundleELResolver()); defaultResolver.add(new ListELResolver()); defaultResolver.add(new ArrayELResolver()); defaultResolver.add(new BeanELResolver()); return defaultResolver; } else { return DefaultResolver; } }
Example #18
Source File: TilesConfigurer.java From spring4-understanding with Apache License 2.0 | 5 votes |
public CompositeELResolverImpl() { add(new ScopeELResolver()); add(new TilesContextELResolver(new TilesContextBeanELResolver())); add(new TilesContextBeanELResolver()); add(new ArrayELResolver(false)); add(new ListELResolver(false)); add(new MapELResolver(false)); add(new ResourceBundleELResolver()); add(new BeanELResolver(false)); }
Example #19
Source File: TilesConfigurer.java From java-technology-stack with MIT License | 5 votes |
public CompositeELResolverImpl() { add(new ScopeELResolver()); add(new TilesContextELResolver(new TilesContextBeanELResolver())); add(new TilesContextBeanELResolver()); add(new ArrayELResolver(false)); add(new ListELResolver(false)); add(new MapELResolver(false)); add(new ResourceBundleELResolver()); add(new BeanELResolver(false)); }
Example #20
Source File: TilesConfigurer.java From lams with GNU General Public License v2.0 | 5 votes |
public CompositeELResolverImpl() { add(new ScopeELResolver()); add(new TilesContextELResolver(new TilesContextBeanELResolver())); add(new TilesContextBeanELResolver()); add(new ArrayELResolver(false)); add(new ListELResolver(false)); add(new MapELResolver(false)); add(new ResourceBundleELResolver()); add(new BeanELResolver(false)); }
Example #21
Source File: ELContextImpl.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
public static ELResolver getDefaultResolver() { if (Constants.IS_SECURITY_ENABLED) { CompositeELResolver defaultResolver = new CompositeELResolver(); defaultResolver.add(new MapELResolver()); defaultResolver.add(new ResourceBundleELResolver()); defaultResolver.add(new ListELResolver()); defaultResolver.add(new ArrayELResolver()); defaultResolver.add(new BeanELResolver()); return defaultResolver; } else { return DefaultResolver; } }
Example #22
Source File: ProcessEngineFactoryWithELResolver.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Override protected ELResolver createElResolver(VariableScope variableScope) { CompositeELResolver compositeElResolver = new CompositeELResolver(); compositeElResolver.add(new VariableScopeElResolver(variableScope)); if (blueprintContextELResolver != null) { compositeElResolver.add(blueprintContextELResolver); } compositeElResolver.add(blueprintELResolver); compositeElResolver.add(new BeanELResolver()); compositeElResolver.add(new ArrayELResolver()); compositeElResolver.add(new ListELResolver()); compositeElResolver.add(new MapELResolver()); return compositeElResolver; }
Example #23
Source File: CdiExpressionManager.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Override protected ELResolver createElResolver(VariableScope variableScope) { CompositeELResolver compositeElResolver = new CompositeELResolver(); compositeElResolver.add(new VariableScopeElResolver(variableScope)); compositeElResolver.add(new CdiResolver()); compositeElResolver.add(new ArrayELResolver()); compositeElResolver.add(new ListELResolver()); compositeElResolver.add(new MapELResolver()); compositeElResolver.add(new BeanELResolver()); return compositeElResolver; }
Example #24
Source File: MockExpressionManager.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
@Override protected ELResolver createElResolver(VariableScope variableScope) { CompositeELResolver compositeElResolver = new CompositeELResolver(); compositeElResolver.add(new VariableScopeElResolver(variableScope)); compositeElResolver.add(new MockElResolver()); compositeElResolver.add(new ArrayELResolver()); compositeElResolver.add(new ListELResolver()); compositeElResolver.add(new MapELResolver()); compositeElResolver.add(new BeanELResolver()); return compositeElResolver; }
Example #25
Source File: BenchmarkEl.java From proctor with Apache License 2.0 | 4 votes |
public static void main(final String[] args) { final FunctionMapper functionMapper = new LibraryFunctionMapperBuilder().add("proctor", ProctorRuleFunctions.class).build(); final ExpressionFactory expressionFactory = new ExpressionFactoryImpl(); final CompositeELResolver elResolver = new CompositeELResolver(); elResolver.add(new ArrayELResolver()); elResolver.add(new ListELResolver()); elResolver.add(new BeanELResolver()); elResolver.add(new MapELResolver()); final Map<String, Object> values = Maps.newLinkedHashMap(); values.put("countries", Sets.newHashSet("AA", "BB", "CC", "DD", "EE", "FF", "GG", "HH", "II", "JJ", "KK", "LL", "MM")); values.put("AA", "AA"); values.put("CC", "CC"); values.put("NN", "NN"); values.put("ZZ", "ZZ"); values.put("I1", 239235); values.put("I2", 569071142); values.put("I3", -189245); values.put("D1", 129835.12512); values.put("D2", -9582.9385); values.put("D3", 98982223.598731412); values.put("BT", Boolean.TRUE); values.put("BF", Boolean.FALSE); values.put("GLOOP", ""); final String[] expressions = { "${proctor:contains(countries, AA) || proctor:contains(countries, CC) || D2 < I3 && BF}", "${! proctor:contains(countries, ZZ) && I1 < I2 && empty GLOOP}", "${I2 - I3 + D3 - D1}", "${NN == '0' && ZZ == 'ZZ'}", "${BT != BF}", }; final int iterations = 100*1000; long elapsed = -System.currentTimeMillis(); for (int i = 0; i < iterations; i++) { final Map<String, ValueExpression> localContext = ProctorUtils.convertToValueExpressionMap(expressionFactory, values); final VariableMapper variableMapper = new MulticontextReadOnlyVariableMapper(localContext); final ELContext elContext = new ELContext() { @Override public ELResolver getELResolver() { return elResolver; } @Override public FunctionMapper getFunctionMapper() { return functionMapper; } @Override public VariableMapper getVariableMapper() { return variableMapper; } }; for (int j = 0; j < expressions.length; j++) { final ValueExpression ve = expressionFactory.createValueExpression(elContext, expressions[j], Object.class); final Object result = ve.getValue(elContext); if (i % 10000 == 0) { System.out.println(result); } } } elapsed += System.currentTimeMillis(); final int total = iterations * expressions.length; System.out.println(total + " expressions in " + elapsed + " ms (average " + (elapsed/(((double) total))) + " ms/expression)"); }