@Test public void testIsTarget() { Map<String, Object> requestScope = new HashMap<String, Object>(); requestScope.put("one", 1); expect(request.getContext("request")).andReturn(requestScope).times( EXPECTED_REQUEST_CALLS); Map<String, Object> applicationScope = new HashMap<String, Object>(); applicationScope.put("two", 2); Map<String, Object> sessionScope = new HashMap<String, Object>(); sessionScope.put("three", "three"); expect(request.getContext("session")).andReturn(sessionScope).times( EXPECTED_SESSION_CALLS); expect(request.getAvailableScopes()).andReturn( Arrays.asList(new String[] { "request", "session", "application" })) .anyTimes(); expect(request.getContext("application")).andReturn(applicationScope).anyTimes(); replay(request, applicationContext); assertTrue(factory.isTarget("one")); assertTrue(factory.isTarget("two")); assertTrue(factory.isTarget("three")); assertFalse(factory.isTarget("four")); verify(request, applicationContext); }
public boolean isTarget(String name) { Request request = requestHolder.getTilesRequestContext(); for (String scope : request.getAvailableScopes()) { if (request.getContext(scope).containsKey(name)) { return true; } } return false; }
TilesContextBeanVariableResolverFactory extends
        ReadOnlyVariableResolverFactory { public boolean isTarget(String name) { Request request = requestHolder.getTilesRequestContext(); for (String scope : request.getAvailableScopes()) { if (request.getContext(scope).containsKey(name)) { return true; } } return false; } }
TilesContextBeanVariableResolverFactory extends
        ReadOnlyVariableResolverFactory { public boolean isTarget(String name) { Request request = requestHolder.getTilesRequestContext(); for (String scope : request.getAvailableScopes()) { if (request.getContext(scope).containsKey(name)) { return true; } } return false; } TilesContextBeanVariableResolverFactory(TilesRequestContextHolder requestHolder); }
TilesContextBeanVariableResolverFactory extends
        ReadOnlyVariableResolverFactory { public boolean isTarget(String name) { Request request = requestHolder.getTilesRequestContext(); for (String scope : request.getAvailableScopes()) { if (request.getContext(scope).containsKey(name)) { return true; } } return false; } TilesContextBeanVariableResolverFactory(TilesRequestContextHolder requestHolder); @Override VariableResolver createVariableResolver(String name); boolean isTarget(String name); }
TilesContextBeanVariableResolverFactory extends
        ReadOnlyVariableResolverFactory { public boolean isTarget(String name) { Request request = requestHolder.getTilesRequestContext(); for (String scope : request.getAvailableScopes()) { if (request.getContext(scope).containsKey(name)) { return true; } } return false; } TilesContextBeanVariableResolverFactory(TilesRequestContextHolder requestHolder); @Override VariableResolver createVariableResolver(String name); boolean isTarget(String name);  }