public OGNLVariableExpressionEvaluator(final boolean applyOGNLShortcuts) { super(); this.applyOGNLShortcuts = applyOGNLShortcuts; /* * INITIALIZE AND REGISTER THE PROPERTY ACCESSOR */ final OGNLContextPropertyAccessor accessor = new OGNLContextPropertyAccessor(); OgnlRuntime.setPropertyAccessor(IContext.class, accessor); }
/** * Add a property access strategy for the given class. * @param clazz the class that contains properties needing access * @param propertyAccessor the property access strategy */ public void addPropertyAccessor(Class clazz, PropertyAccessor propertyAccessor) { OgnlRuntime.setPropertyAccessor(clazz, propertyAccessor); } }
/** * Add a property access strategy for the given class. * @param clazz the class that contains properties needing access * @param propertyAccessor the property access strategy */ public void addPropertyAccessor(Class clazz, PropertyAccessor propertyAccessor) { OgnlRuntime.setPropertyAccessor(clazz, propertyAccessor); }
public OgnlFacade(Converters converters, EmptyElementsRemoval removal, Proxifier proxifier) { this.converters = converters; this.removal = removal; this.proxifier = proxifier; OgnlRuntime.setNullHandler(Object.class, new ReflectionBasedNullHandler(proxifier)); OgnlRuntime.setPropertyAccessor(List.class, new ListAccessor(converters)); OgnlRuntime.setPropertyAccessor(Object[].class, new ArrayAccessor()); }
static void initialize() { try { final OGNLVariablesMapPropertyAccessor accessor = new OGNLVariablesMapPropertyAccessor(); OgnlRuntime.setPropertyAccessor(VariablesMap.class, accessor); } catch (final Exception e) { // We will not ignore this: there's a problem creating an instance of the new property accessor! throw new TemplateProcessingException("Exception while configuring OGNL variables map property accessor", e); } }
public void configureWOForOgnl() { // Configure runtime. // Configure foundation classes. OgnlRuntime.setPropertyAccessor(Object.class, new NSObjectPropertyAccessor()); OgnlRuntime.setPropertyAccessor(NSArray.class, new NSArrayPropertyAccessor()); OgnlRuntime.setPropertyAccessor(NSDictionary.class, new NSDictionaryPropertyAccessor()); NSFoundationElementsAccessor e = new NSFoundationElementsAccessor(); OgnlRuntime.setElementsAccessor(NSArray.class, e); OgnlRuntime.setElementsAccessor(NSDictionary.class, e); OgnlRuntime.setElementsAccessor(NSSet.class, e); // Register template parser if (hasProperty("ognl.active", "true")) { String parserClassName = System.getProperty("ognl.parserClassName", "ognl.helperfunction.WOHelperFunctionParser54"); WOComponentTemplateParser.setWOHTMLTemplateParserClassName(parserClassName); if (hasProperty("ognl.inlineBindings", "false")) { WOHelperFunctionTagRegistry.setAllowInlineBindings(true); } if (hasProperty("ognl.parseStandardTags", "false")) { WOHelperFunctionHTMLParser.setParseStandardTags(true); } if (hasProperty("ognl.debugSupport", "false")) { WOHelperFunctionParser._debugSupport = true; } } }
PropertyAccessor acc = container.getInstance(PropertyAccessor.class, name); OgnlRuntime.setPropertyAccessor(cls, container.getInstance(PropertyAccessor.class, name)); if (compoundRootAccessor == null && CompoundRoot.class.isAssignableFrom(cls)) { compoundRootAccessor = (CompoundRootAccessor) container.getInstance(PropertyAccessor.class, name);
OgnlRuntime.setPropertyAccessor(c.getSubjectClass(), c.getAccessor());
OgnlRuntime.setPropertyAccessor(c.getSubjectClass(), c.getAccessor());
public static void configOgnl(Converters converters) throws OgnlException { Proxifier proxifier = new JavassistProxifier(new ReflectionInstanceCreator()); OgnlRuntime.setNullHandler(Object.class, new ReflectionBasedNullHandler(proxifier)); OgnlRuntime.setPropertyAccessor(List.class, new ListAccessor(converters)); OgnlRuntime.setPropertyAccessor(Object[].class, new ArrayAccessor()); }
protected OGNLAttributeEvaluator createOGNLEvaluator() { try { PropertyAccessor objectPropertyAccessor = OgnlRuntime.getPropertyAccessor(Object.class); PropertyAccessor applicationContextPropertyAccessor = new NestedObjectDelegatePropertyAccessor<>( new TilesApplicationContextNestedObjectExtractor(), objectPropertyAccessor); PropertyAccessor anyScopePropertyAccessor = new AnyScopePropertyAccessor(); PropertyAccessor scopePropertyAccessor = new ScopePropertyAccessor(); PropertyAccessorDelegateFactory<Request> factory = new TilesContextPropertyAccessorDelegateFactory( objectPropertyAccessor, applicationContextPropertyAccessor, anyScopePropertyAccessor, scopePropertyAccessor); PropertyAccessor tilesRequestAccessor = new DelegatePropertyAccessor<>(factory); OgnlRuntime.setPropertyAccessor(Request.class, tilesRequestAccessor); return new OGNLAttributeEvaluator(); } catch (OgnlException e) { throw new TilesContainerFactoryException("Cannot initialize OGNL evaluator", e); } }
/** * Creates the OGNL evaluator. * * @return The OGNL evaluator. */ private OGNLAttributeEvaluator createOGNLEvaluator() { try { PropertyAccessor objectPropertyAccessor = OgnlRuntime.getPropertyAccessor(Object.class); PropertyAccessor applicationContextPropertyAccessor = new NestedObjectDelegatePropertyAccessor<Request>( new TilesApplicationContextNestedObjectExtractor(), objectPropertyAccessor); PropertyAccessor anyScopePropertyAccessor = new AnyScopePropertyAccessor(); PropertyAccessor scopePropertyAccessor = new ScopePropertyAccessor(); PropertyAccessorDelegateFactory<Request> factory = new TilesContextPropertyAccessorDelegateFactory( objectPropertyAccessor, applicationContextPropertyAccessor, anyScopePropertyAccessor, scopePropertyAccessor); PropertyAccessor tilesRequestAccessor = new DelegatePropertyAccessor<Request>(factory); OgnlRuntime.setPropertyAccessor(Request.class, tilesRequestAccessor); return new OGNLAttributeEvaluator(); } catch (OgnlException e) { throw new TilesContainerFactoryException("Cannot initialize OGNL evaluator", e); } } }