1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
package org.apache.tiles.test.factory; |
22 | |
|
23 | |
import java.util.ArrayList; |
24 | |
import java.util.List; |
25 | |
|
26 | |
import org.apache.tiles.TilesContainer; |
27 | |
import org.apache.tiles.evaluator.AttributeEvaluatorFactory; |
28 | |
import org.apache.tiles.extras.complete.CompleteAutoloadTilesContainerFactory; |
29 | |
import org.apache.tiles.request.ApplicationContext; |
30 | |
import org.apache.tiles.request.ApplicationResource; |
31 | |
import org.apache.tiles.request.render.BasicRendererFactory; |
32 | |
import org.apache.tiles.test.renderer.ReverseStringRenderer; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | 0 | public class TestTilesContainerFactory extends CompleteAutoloadTilesContainerFactory { |
41 | |
|
42 | |
|
43 | |
@Override |
44 | |
protected void registerAttributeRenderers( |
45 | |
BasicRendererFactory rendererFactory, |
46 | |
ApplicationContext applicationContext, |
47 | |
TilesContainer container, |
48 | |
AttributeEvaluatorFactory attributeEvaluatorFactory) { |
49 | 0 | super.registerAttributeRenderers(rendererFactory, applicationContext, container, |
50 | |
attributeEvaluatorFactory); |
51 | 0 | ReverseStringRenderer renderer = new ReverseStringRenderer(); |
52 | 0 | rendererFactory.registerRenderer("reversed", renderer); |
53 | 0 | } |
54 | |
|
55 | |
|
56 | |
@Override |
57 | |
protected List<ApplicationResource> getSources(ApplicationContext applicationContext) { |
58 | 0 | List<ApplicationResource> urls = new ArrayList<ApplicationResource>(); |
59 | 0 | urls.addAll(applicationContext |
60 | |
.getResources("/WEB-INF/**/tiles-defs*.xml")); |
61 | 0 | urls.add(applicationContext.getResource( |
62 | |
"classpath:/org/apache/tiles/classpath-defs.xml")); |
63 | 0 | urls.add(applicationContext.getResource( |
64 | |
"classpath:/org/apache/tiles/freemarker-classpath-defs.xml")); |
65 | 0 | urls.add(applicationContext.getResource( |
66 | |
"classpath:/org/apache/tiles/velocity-classpath-defs.xml")); |
67 | 0 | return urls; |
68 | |
} |
69 | |
} |