@Test public void testGetValue() { ELContext elContext = createMock(ELContext.class); Request request = createMock(Request.class); ApplicationContext applicationContext = createMock(ApplicationContext.class); @SuppressWarnings("rawtypes") Map map = createMock(Map.class); expect(elContext.getContext(Request.class)).andReturn(request); expect(elContext.getContext(ApplicationContext.class)).andReturn(applicationContext); expect(beanElResolver.getValue(elContext, request, "responseCommitted")).andReturn(true); expect(beanElResolver.getValue(elContext, applicationContext, "initParams")).andReturn(map); elContext.setPropertyResolved(true); expectLastCall().times(2); replay(beanElResolver, elContext, request, applicationContext, map); assertNull(resolver.getValue(elContext, new Integer(1), "whatever")); assertEquals(true, resolver.getValue(elContext, null, "responseCommitted")); assertEquals(map, resolver.getValue(elContext, null, "initParams")); verify(beanElResolver, elContext, request, applicationContext, map); }
@Override public Object getValue(ELContext context, Object base, Object property) { if (base != null) { return null; } Object retValue = null; if (requestBeanInfo.getProperties(Request.class).contains(property)) { Request request = (Request) context .getContext(Request.class); retValue = beanElResolver.getValue(context, request, property); } else if (requestBeanInfo.getProperties(ApplicationContext.class) .contains(property)) { ApplicationContext applicationContext = (ApplicationContext) context .getContext(ApplicationContext.class); retValue = beanElResolver.getValue(context, applicationContext, property); } if (retValue != null) { context.setPropertyResolved(true); } return retValue; }
TilesContextELResolver extends ELResolver { @Override public Object getValue(ELContext context, Object base, Object property) { if (base != null) { return null; } Object retValue = null; if (requestBeanInfo.getProperties(Request.class).contains(property)) { Request request = (Request) context .getContext(Request.class); retValue = beanElResolver.getValue(context, request, property); } else if (requestBeanInfo.getProperties(ApplicationContext.class) .contains(property)) { ApplicationContext applicationContext = (ApplicationContext) context .getContext(ApplicationContext.class); retValue = beanElResolver.getValue(context, applicationContext, property); } if (retValue != null) { context.setPropertyResolved(true); } return retValue; } }
TilesContextELResolver extends ELResolver { @Override public Object getValue(ELContext context, Object base, Object property) { if (base != null) { return null; } Object retValue = null; if (requestBeanInfo.getProperties(Request.class).contains(property)) { Request request = (Request) context .getContext(Request.class); retValue = beanElResolver.getValue(context, request, property); } else if (requestBeanInfo.getProperties(ApplicationContext.class) .contains(property)) { ApplicationContext applicationContext = (ApplicationContext) context .getContext(ApplicationContext.class); retValue = beanElResolver.getValue(context, applicationContext, property); } if (retValue != null) { context.setPropertyResolved(true); } return retValue; } TilesContextELResolver(ELResolver beanElResolver); }
TilesContextELResolver extends ELResolver { @Override public Object getValue(ELContext context, Object base, Object property) { if (base != null) { return null; } Object retValue = null; if (requestBeanInfo.getProperties(Request.class).contains(property)) { Request request = (Request) context .getContext(Request.class); retValue = beanElResolver.getValue(context, request, property); } else if (requestBeanInfo.getProperties(ApplicationContext.class) .contains(property)) { ApplicationContext applicationContext = (ApplicationContext) context .getContext(ApplicationContext.class); retValue = beanElResolver.getValue(context, applicationContext, property); } if (retValue != null) { context.setPropertyResolved(true); } return retValue; } TilesContextELResolver(ELResolver beanElResolver); @Override Class<?> getCommonPropertyType(ELContext context, Object base); @Override Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,
            Object base); @Override Class<?> getType(ELContext context, Object base, Object property); @Override Object getValue(ELContext context, Object base, Object property); @Override boolean isReadOnly(ELContext context, Object base, Object property); @Override void setValue(ELContext context, Object base, Object property,
            Object value); }
TilesContextELResolver extends ELResolver { @Override public Object getValue(ELContext context, Object base, Object property) { if (base != null) { return null; } Object retValue = null; if (requestBeanInfo.getProperties(Request.class).contains(property)) { Request request = (Request) context .getContext(Request.class); retValue = beanElResolver.getValue(context, request, property); } else if (requestBeanInfo.getProperties(ApplicationContext.class) .contains(property)) { ApplicationContext applicationContext = (ApplicationContext) context .getContext(ApplicationContext.class); retValue = beanElResolver.getValue(context, applicationContext, property); } if (retValue != null) { context.setPropertyResolved(true); } return retValue; } TilesContextELResolver(ELResolver beanElResolver); @Override Class<?> getCommonPropertyType(ELContext context, Object base); @Override Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,
            Object base); @Override Class<?> getType(ELContext context, Object base, Object property); @Override Object getValue(ELContext context, Object base, Object property); @Override boolean isReadOnly(ELContext context, Object base, Object property); @Override void setValue(ELContext context, Object base, Object property,
            Object value);  }