Author: apetrelli
Date: Tue Sep 30 08:12:54 2008
New Revision: 700494
URL: http://svn.apache.org/viewvc?rev=700494&view=rev
Log:
TILES-308
Added documentation for wildcards when loading XML definition files.
Added:
tiles/framework/trunk/src/site/apt/tutorial/wildcard-configuration.apt
Modified:
tiles/framework/trunk/src/site/apt/config-reference.apt
tiles/framework/trunk/src/site/apt/tutorial/index.apt
tiles/framework/trunk/src/site/site.xml
Modified: tiles/framework/trunk/src/site/apt/config-reference.apt
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/apt/config-reference.apt?rev=700494&r1=700493&r2=700494&view=diff
==============================================================================
--- tiles/framework/trunk/src/site/apt/config-reference.apt (original)
+++ tiles/framework/trunk/src/site/apt/config-reference.apt Tue Sep 30 08:12:54
2008
@@ -42,6 +42,8 @@
*---------------------------------------------+--------------------------------------+
|
{{{config-reference.html#org.apache.tiles.definition.DefinitionsFactory}<<<org.apache.tiles.definition.DefinitionsFactory>>>}}
| Definitions factory class name |
*---------------------------------------------+--------------------------------------+
+|
{{{config-reference.html#org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG}<<<org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG>>>}}
| List of paths that contain Tiles definitions |
+*---------------------------------------------+--------------------------------------+
|
{{{config-reference.html#org.apache.tiles.evaluator.AttributeEvaluator}<<<org.apache.tiles.evaluator.AttributeEvaluator>>>}}
| Attribute evaluator class name |
*---------------------------------------------+--------------------------------------+
|
{{{config-reference.html#org.apache.tiles.preparer.PreparerFactory}<<<org.apache.tiles.preparer.PreparerFactory>>>}}
| View preparer factory class name |
@@ -53,25 +55,19 @@
|
{{{config-reference.html#org.apache.tiles.renderer.impl.BasicRendererFactory.DEFAULT_RENDERER}<<<org.apache.tiles.renderer.impl.BasicRendererFactory.DEFAULT_RENDERER>>>}}
| Default attribute renderer class name |
*---------------------------------------------+--------------------------------------+
- [[2]] {{{config-reference.html#BasicTilesContainer
configuration}<<<BasicTilesContainer>>> configuration}}.
-
-*---------------------------------------------+--------------------------------------+
-|
{{{config-reference.html#org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG}<<<org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG>>>}}
| List of paths that contain Tiles definitions |
-*---------------------------------------------+--------------------------------------+
-
- [[3]] {{{config-reference.html#ChainedTilesContextFactory
configuration}<<<ChainedTilesContextFactory>>> configuration}}.
+ [[2]] {{{config-reference.html#ChainedTilesContextFactory
configuration}<<<ChainedTilesContextFactory>>> configuration}}.
*---------------------------------------------+--------------------------------------+
|
{{{config-reference.html#org.apache.tiles.context.ChainedTilesContextFactory.FACTORY_CLASS_NAMES}<<<org.apache.tiles.context.ChainedTilesContextFactory.FACTORY_CLASS_NAMES>>>}}
| List of elementary factory class names |
*---------------------------------------------+--------------------------------------+
- [[4]] {{{config-reference.html#DigesterDefinitionsReader
configuration}<<<DigesterDefinitionsReader>>> configuration}}.
+ [[3]] {{{config-reference.html#DigesterDefinitionsReader
configuration}<<<DigesterDefinitionsReader>>> configuration}}.
*---------------------------------------------+--------------------------------------+
|
{{{config-reference.html#org.apache.tiles.definition.digester.DigesterDefinitionsReader.PARSER_VALIDATE}<<<org.apache.tiles.definition.digester.DigesterDefinitionsReader.PARSER_VALIDATE>>>}}
| Flag to deactivate XML parser validation |
*---------------------------------------------+--------------------------------------+
- [[5]] {{{config-reference.html#UrlDefinitionsFactory
configuration}<<<UrlDefinitionsFactory>>> configuration}}.
+ [[4]] {{{config-reference.html#UrlDefinitionsFactory
configuration}<<<UrlDefinitionsFactory>>> configuration}}.
*---------------------------------------------+--------------------------------------+
|
{{{config-reference.html#org.apache.tiles.definition.DefinitionsReader}<<<org.apache.tiles.definition.DefinitionsReader>>>}}
| Definitions reader class name |
@@ -211,12 +207,12 @@
* {<<<BasicTilesContainer>>> configuration}
-** {<<<org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG>>>}
+** {<<<org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG>>>}
Specifies the list of files that contain the definitions.
* <<Specified in>>:
-
{{{framework/apidocs/org/apache/tiles/impl/BasicTilesContainer.html#DEFINITIONS_CONFIG}<<<org.apache.tiles.impl.BasicTilesContainer>>>}}.
+
{{{framework/apidocs/org/apache/tiles/definition/DefinitionsFactory.html#DEFINITIONS_CONFIG}<<<org.apache.tiles.definition.DefinitionsFactory>>>}}.
* <<Default>>: <<</WEB-INF/tiles.xml>>>.
Modified: tiles/framework/trunk/src/site/apt/tutorial/index.apt
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/apt/tutorial/index.apt?rev=700494&r1=700493&r2=700494&view=diff
==============================================================================
--- tiles/framework/trunk/src/site/apt/tutorial/index.apt (original)
+++ tiles/framework/trunk/src/site/apt/tutorial/index.apt Tue Sep 30 08:12:54
2008
@@ -33,13 +33,15 @@
[[3]] {{{configuration.html}Configuring your web application}}
- [[4]] {{{basic/index.html}Basic Usage}}
+ [[4]] {{{wildcard-configuration.html}Wildcards in configuration files}}
+
+ [[5]] {{{basic/index.html}Basic Usage}}
[[1]] {{{basic/concepts.html}Tiles Concepts}}
[[2]] {{{basic/pages.html}Creating Tiles Pages}}
- [[5]] {{{advanced/index.html}Advanced Topics}}
+ [[6]] {{{advanced/index.html}Advanced Topics}}
[[1]] {{{advanced/nesting-extending.html}Nesting and Extending
Definitions}}
@@ -63,13 +65,13 @@
[[11]] {{{advanced/attribute-rendering.html}Attribute rendering}}
- [[6]] {{{integration/index.html}Integration with other technologies}}
+ [[7]] {{{integration/index.html}Integration with other technologies}}
[[1]] {{{integration/frameworks.html}Integration with other
frameworks}}
[[2]] {{{integration/view.html}Integration with other view
technologies}}
- [[7]] {{{extension/index.html}Extending Tiles}}
+ [[8]] {{{extension/index.html}Extending Tiles}}
[[1]] {{{extension/points.html}Tiles Extension Points}}
Added: tiles/framework/trunk/src/site/apt/tutorial/wildcard-configuration.apt
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/apt/tutorial/wildcard-configuration.apt?rev=700494&view=auto
==============================================================================
--- tiles/framework/trunk/src/site/apt/tutorial/wildcard-configuration.apt
(added)
+++ tiles/framework/trunk/src/site/apt/tutorial/wildcard-configuration.apt Tue
Sep 30 08:12:54 2008
@@ -0,0 +1,142 @@
+~~ $Id: configuration.apt 699348 2008-09-26 14:56:42Z apetrelli $
+~~
+~~ Licensed to the Apache Software Foundation (ASF) under one
+~~ or more contributor license agreements. See the NOTICE file
+~~ distributed with this work for additional information
+~~ regarding copyright ownership. The ASF licenses this file
+~~ to you under the Apache License, Version 2.0 (the
+~~ "License"); you may not use this file except in compliance
+~~ with the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing,
+~~ software distributed under the License is distributed on an
+~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+~~ KIND, either express or implied. See the License for the
+~~ specific language governing permissions and limitations
+~~ under the License.
+~~
+ -----------
+ Load XML definition files using wildcards
+ -----------
+
+Load XML definition files using wildcards
+
+ XML definition files can be loaded using wildcard, but this behaviour is not
+ the default, due to compatibility reasons to Tiles 2.0.x.
+
+* Prerequisites
+
+ To use wildcards in XML definition files, you need to put the following
libraries
+ in your classpath:
+
+ * spring-core.jar
+
+ * spring-web.jar
+
+ * spring-context.jar
+
+ * spring-beans.jar
+
+ * aopalliance.jar
+
+ If you are using Maven, simply depend on <<<spring-web>>> package.
+
+* Configuration
+
+ To be able to specify Tiles XML definition files using wildcards, there is
the
+ need for some configuration:
+
+ * If you are using parameter-based initialization, provide a new value for
the
+
{{{../config-reference.html#org.apache.tiles.context.ChainedTilesContextFactory.FACTORY_CLASS_NAMES}<<<org.apache.tiles.context.ChainedTilesContextFactory.FACTORY_CLASS_NAMES>>>}}
+ init parameter. For example:
+
+----------------------------------------
+<init-param>
+
<param-name>org.apache.tiles.context.ChainedTilesContextFactory.FACTORY_CLASS_NAMES</param-name>
+
<param-value>org.apache.tiles.servlet.context.wildcard.WildcardServletTilesContextFactory,
+ org.apache.tiles.jsp.context.JspTilesContextFactory</param-value>
+</init-param>
+----------------------------------------
+
+ * If you are using Java-based configuration, override the
+
{{{../apidocs/org/apache/tiles/factory/BasicTilesContainerFactory.html#registerChainedContextFactories(java.lang.Object,%20org.apache.tiles.context.ChainedTilesContextFactory)}registerChainedContextFactories}}
+ of <<<BasicTilesContainerFactory>>> this way:
+
+----------------------------------------
+/** [EMAIL PROTECTED] */
[EMAIL PROTECTED]
+protected void registerChainedContextFactories(Object context,
+ ChainedTilesContextFactory contextFactory) {
+ List<TilesContextFactory> factories = new ArrayList<TilesContextFactory>(
+ CONTEXT_FACTORY_CHAIN_COUNT);
+ factories.add(new WildcardServletTilesContextFactory());
+ factories.add(new JspTilesContextFactory());
+ contextFactory.setFactories(factories);
+}
+----------------------------------------
+
+* Usage
+
+ To load XML definition files using wilcards you can proceed, as usual, in two
+ ways:
+
+
+ * If you are using parameter-based initialization, provide a new value for
the
+
{{{../config-reference.html#org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG}<<<org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG>>>}}
+ init parameter. The files that have an underscore (_) in their name will be
+ skipped. You can specify, for example:
+
+----------------------------------------
+<init-param>
+
<param-name>org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG</param-name>
+ <param-value>/WEB-INF/tiles-defs*.xml,
+ classpath:/org/apache/**/tiles-defs.xml</param-value>
+</init-param>
+----------------------------------------
+
+ * If you are using Java-based configuration, override the
+
{{{../apidocs/org/apache/tiles/factory/BasicTilesContainerFactory.html#getSourceURLs(java.lang.Object,%20org.apache.tiles.TilesApplicationContext,%20org.apache.tiles.context.TilesContextFactory)}getSourceURLs}}
+ of <<<BasicTilesContainerFactory>>>. In the following example, notice the
+ manual exclusion of files including underscores (_):
+
+----------------------------------------
+/** [EMAIL PROTECTED] */
[EMAIL PROTECTED]
+protected List<URL> getSourceURLs(Object context,
+ TilesApplicationContext applicationContext,
+ TilesContextFactory contextFactory) {
+ List<URL> urls = new ArrayList<URL>(URL_COUNT);
+ try {
+ Set<URL> urlSet = applicationContext
+ .getResources("/WEB-INF/tiles-defs*.xml");
+ for (URL url : urlSet) {
+ String externalForm = url.toExternalForm();
+ if (externalForm.indexOf('_', externalForm.lastIndexOf("/")) < 0) {
+ urls.add(url);
+ }
+ }
+ urls.add(applicationContext.getResource(
+ "classpath:/org/apache/tiles/classpath-defs.xml"));
+ } catch (IOException e) {
+ throw new DefinitionsFactoryException(
+ "Cannot load definition URLs", e);
+ }
+ return urls;
+}
+----------------------------------------
+
+* Syntax
+
+ Wildcard support uses Spring Framework syntax for loading files. For example:
+
+ * one asterisk (*) for a single placeholder;
+
+ * two asterisks (**) to say "in every directory under the specified one";
+
+ * the <<<classpath:>>> prefix loads files from the classpath.
+
+ * etc.
+
+ For everything else, see Spring's documentation.
Modified: tiles/framework/trunk/src/site/site.xml
URL:
http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/site.xml?rev=700494&r1=700493&r2=700494&view=diff
==============================================================================
--- tiles/framework/trunk/src/site/site.xml (original)
+++ tiles/framework/trunk/src/site/site.xml Tue Sep 30 08:12:54 2008
@@ -66,6 +66,9 @@
name="Configuration"
href="tutorial/configuration.html"/>
<item
+ name="Wildcards in configuration files"
+ href="tutorial/wildcard-configuration.html"/>
+ <item
name="Basic Usage"
href="tutorial/basic/index.html"
collapse="true">