Esempio n. 1
0
 static {
   OgnlRuntime.setPropertyAccessor(S2Container.class, new S2ContainerPropertyAccessor());
   Desc.useContextClassLoader = true;
   ProxyFactory.classLoaderProvider =
       new ClassLoaderProvider() {
         public ClassLoader get(ProxyFactory proxyFactory) {
           return Thread.currentThread().getContextClassLoader();
         }
       };
 }
 @Before
 public void setup() {
   this.handler = new ReflectionBasedNullHandler();
   this.context = (OgnlContext) Ognl.createDefaultContext(null);
   context.setTraceEvaluations(true);
   this.mockery = new VRaptorMockery(true);
   this.container = mockery.mock(Container.class);
   context.put(Container.class, container);
   this.removal = mockery.mock(EmptyElementsRemoval.class);
   this.converters = mockery.mock(Converters.class);
   mockery.checking(
       new Expectations() {
         {
           allowing(container).instanceFor(EmptyElementsRemoval.class);
           will(returnValue(removal));
           allowing(container).instanceFor(Converters.class);
           will(returnValue(converters));
         }
       });
   OgnlRuntime.setPropertyAccessor(List.class, new ListAccessor());
   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);
   }
 }
Esempio n. 4
0
 static {
   OgnlRuntime.setPropertyAccessor(ContextMap.class, new ContextAccessor());
 }