1/*2 * $Id: TestTilesContainerFactory.java 1297705 2012-03-06 20:44:30Z nlebas $3 *4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */21package org.apache.tiles.test.factory;
2223import java.util.ArrayList;
24import java.util.List;
2526import org.apache.tiles.TilesContainer;
27import org.apache.tiles.evaluator.AttributeEvaluatorFactory;
28import org.apache.tiles.extras.complete.CompleteAutoloadTilesContainerFactory;
29import org.apache.tiles.request.ApplicationContext;
30import org.apache.tiles.request.ApplicationResource;
31import org.apache.tiles.request.render.BasicRendererFactory;
32import org.apache.tiles.test.renderer.ReverseStringRenderer;
333435/**36 * Test Tiles container factory to customize Tiles behaviour.37 *38 * @version $Rev: 1297705 $ $Date: 2012-03-07 07:44:30 +1100 (Wed, 07 Mar 2012) $39 */40publicclassTestTilesContainerFactoryextendsCompleteAutoloadTilesContainerFactory {
4142/** {@inheritDoc} */43 @Override
44protectedvoid registerAttributeRenderers(
45 BasicRendererFactory rendererFactory,
46 ApplicationContext applicationContext,
47TilesContainer container,
48AttributeEvaluatorFactory attributeEvaluatorFactory) {
49super.registerAttributeRenderers(rendererFactory, applicationContext, container,
50 attributeEvaluatorFactory);
51ReverseStringRenderer renderer = newReverseStringRenderer();
52 rendererFactory.registerRenderer("reversed", renderer);
53 }
5455/** {@inheritDoc} */56 @Override
57protected List<ApplicationResource> getSources(ApplicationContext applicationContext) {
58 List<ApplicationResource> urls = new ArrayList<ApplicationResource>();
59 urls.addAll(applicationContext
60 .getResources("/WEB-INF/**/tiles-defs*.xml"));
61 urls.add(applicationContext.getResource(
62"classpath:/org/apache/tiles/classpath-defs.xml"));
63 urls.add(applicationContext.getResource(
64"classpath:/org/apache/tiles/freemarker-classpath-defs.xml"));
65 urls.add(applicationContext.getResource(
66"classpath:/org/apache/tiles/velocity-classpath-defs.xml"));
67return urls;
68 }
69 }