ScopeELResolver extends ELResolver { @Override public Object getValue(ELContext context, Object base, Object property) { if (base != null) { return null; } Object retValue = null; String propertyString = (String) property; if (property instanceof String && propertyString.endsWith("Scope")) { Request request = (Request) context .getContext(Request.class); retValue = request.getContext(propertyString.substring(0, propertyString.length() - SUFFIX_LENGTH)); } if (retValue != null) { context.setPropertyResolved(true); } return retValue; }  @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);  }
@Test public void testGetValue() { Map<String, Object> requestScope = new HashMap<String, Object>(); requestScope.put("objectKey", "objectValue"); Map<String, Object> sessionScope = new HashMap<String, Object>(); sessionScope.put("sessionObjectKey", "sessionObjectValue"); Map<String, Object> applicationScope = new HashMap<String, Object>(); applicationScope.put("applicationObjectKey", "applicationObjectValue"); Request request = createMock(Request.class); expect(request.getContext("request")).andReturn(requestScope); expect(request.getContext("session")).andReturn(sessionScope); ApplicationContext applicationContext = createMock(ApplicationContext.class); expect(request.getContext("application")).andReturn(applicationScope); ELContext context = new ELContextImpl(resolver); replay(request, applicationContext); context.putContext(Request.class, request); context.putContext(ApplicationContext.class, applicationContext); assertNull(resolver.getValue(context, new Integer(1), "whatever")); assertEquals("The requestScope map does not correspond", requestScope, resolver.getValue(context, null, "requestScope")); assertEquals("The sessionScope map does not correspond", sessionScope, resolver.getValue(context, null, "sessionScope")); assertEquals("The applicationScope map does not correspond", applicationScope, resolver.getValue(context, null, "applicationScope")); }