diff --git a/assembly/pom.xml b/assembly/pom.xml
index 39a117712..af565eb19 100644
--- a/assembly/pom.xml
+++ b/assembly/pom.xml
@@ -30,7 +30,7 @@
org.apache.tilestiles-parent
- 3.0.0-SNAPSHOT
+ 3.0.9-SNAPSHOT
@@ -58,6 +58,13 @@
+
+
+ org.apache.maven.wagon
+ wagon-ssh
+ 2.5
+
+
@@ -67,12 +74,12 @@
org.apache.maven.pluginsmaven-assembly-plugin
- 2.2-beta-4
+ 3.1.0make-assembly
- attached
+ singlepackage
@@ -93,6 +100,28 @@
true
+
+ net.nicoulaj.maven.plugins
+ checksum-maven-plugin
+ 1.6
+
+
+
+ artifacts
+
+
+
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+
+ ${project.build.directory}/..
+
+ org.apache.maven.pluginsmaven-antrun-plugin
@@ -192,12 +221,9 @@
jar
-
org.slf4j
- slf4j-jdk14
- 1.5.8
- runtime
+ slf4j-api
diff --git a/assembly/src/site/site.xml b/assembly/src/site/site.xml
index f7e677d03..de31de869 100644
--- a/assembly/src/site/site.xml
+++ b/assembly/src/site/site.xml
@@ -22,19 +22,65 @@
*/
-->
+
+ org.apache.maven.skins
+ maven-fluido-skin
+ 1.3.0
+
+
+
+ true
+ false
+ true
+
+ apache/tiles
+ right
+ darkblue
+
+
+
+
+ Apache Tiles™
+ http://tiles.apache.org/images/logo.png
+ http://tiles.apache.org
+
+
+ Apache Software Foundation
+ http://struts.apache.org/images/asf-logo.gif
+ http://www.apache.org
+
${modules}
${reports}
+
+
diff --git a/pom.xml b/pom.xml
index 77ea58404..364912964 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,14 +26,14 @@
tiles-masterorg.apache.tiles
- 4
+ 64.0.0org.apache.tilestiles-parent
- 3.0.0-SNAPSHOT
+ 3.0.9-SNAPSHOTpomTiles 3Tiles 3: A framework for page composition.
@@ -71,7 +71,7 @@
apache-site
- scp://people.apache.org/www/tiles.apache.org/framework
+ scm:svn:https://svn.apache.org/repos/asf/tiles/site/staging/framework
@@ -216,14 +216,13 @@
org.slf4j
- slf4j-jdk14
- 1.5.8
- true
+ slf4j-api
+ 1.7.6org.slf4jjcl-over-slf4j
- 1.5.8
+ 1.7.6true
@@ -255,6 +254,10 @@
2.3.7true
+
+ maven-remote-resources-plugin
+ 1.5
+
@@ -292,11 +295,11 @@
- org.apache.maven.plugins
- maven-release-plugin
+ org.apache.maven.plugins
+ maven-scm-publish-plugin
+ true
- apache-release
- deploy site-deploy
+ scm:svn:https://svn.apache.org/repos/asf/tiles/site/staging/framework
@@ -312,11 +315,18 @@
target/osgi/MANIFEST.MFUTF-8
- 1.0.0
- 1.0.0
+ 1.0.7
+ 1.2
-
+
+
+ org.slf4j
+ slf4j-simple
+ 1.5.8
+ test
+
+
diff --git a/src/site/apt/config-reference.apt b/src/site/apt/config-reference.apt
index 71a7b6dce..8dd602c5e 100644
--- a/src/site/apt/config-reference.apt
+++ b/src/site/apt/config-reference.apt
@@ -143,9 +143,14 @@ Configuring Tiles internals
The reason to use a custom Tiles application context could be:
- * supporting a platform not supported yet;
+ * supporting a platform not supported yet;
- * providing custom behaviour, such as loading resources in a different manner.
+ * providing custom behaviour, such as loading resources in a different manner.
+
+
+ When loading resources (by {{{/tiles-request/apidocs/org/apache/tiles/request/locale/PostfixedApplicationResource.html}default}})
+ an underscore in the name of a file is used to indicate locale information.
+ See the documentation for {{{/framework/tutorial/advanced/l10n.html}localization}}.
* Custom {TilesContainerFactory}
@@ -160,41 +165,41 @@ Configuring Tiles internals
{{{./apidocs/org/apache/tiles/factory/BasicTilesContainerFactory.html}Javadoc documentation of BasicTilesContainerFactory}}
documents all the methods that can be overridden to use your own
configuration.
-
+
** Changing the path for the Tiles Definitions file
The <<>> loads the "/WEB-INF/tiles.xml" file; the <<>>
loads all the files named "tiles*.xml" under /WEB-INF and under every META-INF in any part of the classpath.
-
+
If this behaviour doesn't suits you, you can override the method <<>> and retrieve whatever resource you
prefer. Just specify the path for the default locale; Tiles will extrapolate and load the localized files as needed.
* Custom components
These components can be used by overriding the appropriate <<>> method in a custom TilesContainerFactory.
-
+
** Custom {LocaleResolver}
-
+
The default implementation is {{{./apidocs/org/apache/tiles/locale/impl/DefaultLocaleResolver.html}DefaultLocaleResolver}}.
** Custom {DefinitionDAO}
The default implementation is {{{./apidocs/org/apache/tiles/definition/dao/ResolvingLocaleUrlDefinitionDAO.html}ResolvingLocaleUrlDefinitionDAO}}.
-
+
** Custom {AttributeEvaluatorFactory}
The default implementation is {{{./apidocs/org/apache/tiles/evaluator/BasicAttributeEvaluatorFactory.html}BasicAttributeEvaluatorFactory}}.
-
+
It can be used with a number of AttributeEvaluators like:
-
- * the {{{./apidocs/org/apache/tiles/evaluator/impl/DirectAttributeEvaluator.html}DirectAttributeEvaluator}},
- * the {{{./apidocs/org/apache/tiles/el/ELAttributeEvaluator.html}ELAttributeEvaluator}},
+ * the {{{./apidocs/org/apache/tiles/evaluator/impl/DirectAttributeEvaluator.html}DirectAttributeEvaluator}},
+
+ * the {{{./apidocs/org/apache/tiles/el/ELAttributeEvaluator.html}ELAttributeEvaluator}},
+
+ * the {{{./apidocs/org/apache/tiles/mvel/MVELAttributeEvaluator.html}MVELAttributeEvaluator}},
- * the {{{./apidocs/org/apache/tiles/mvel/MVELAttributeEvaluator.html}MVELAttributeEvaluator}},
+ * the {{{./apidocs/org/apache/tiles/ognl/OGNLAttributeEvaluator.html}OGNLAttributeEvaluator}}.
- * the {{{./apidocs/org/apache/tiles/ognl/OGNLAttributeEvaluator.html}OGNLAttributeEvaluator}}.
-
Please see {{{./xref/org/apache/tiles/extras/complete/CompleteAutoloadTilesContainerFactory.html}CompleteAutoloadTilesContainerFactory}}
for an example of how to configure those.
@@ -214,20 +219,20 @@ Configuring Tiles internals
The default implementation is {{{./apidocs/org/apache/tiles/definition/pattern/BasicPatternDefinitionResolver.html}BasicPatternDefinitionResolver}},
that implements the syntax.
-
- <<>> defines a <<>> to enable the use of
+
+ <<>> defines a <<>> to enable the use of
both the syntax and the syntax, with appropriate prefixes.
* Registering {Renderers}
Custom {{{/tiles-request/apidocs/org/apache/tiles/request/render/Renderer.html}Renderers}} can be registered by overriding the methods
<<>> and <<>>.
-
+
<<>> registers 3 renderers: <<>>, <<>>, and <<>>, in order to
render plain strings, JSPs and tiles definitions.
-
- <<>> registers 5 renderers: <<>>, <<>>, <<>>,
- <<>> and <<>>, in order to render plain strings, JSPs, freemarker and velocity templates
+
+ <<>> registers 5 renderers: <<>>, <<>>, <<>>,
+ <<>> and <<>>, in order to render plain strings, JSPs, freemarker and velocity templates
and tiles definitions.
* Changing the {definition files}
@@ -245,6 +250,6 @@ protected List getSources(ApplicationContext applicationCon
-----------
Please note that when using <<>>,
- the <<>> loads the resources via spring, and supports
+ the <<>> loads the resources via spring, and supports
{{{http://static.springsource.org/spring/docs/2.5.x/reference/resources.html#resources-resource-strings}the spring syntax}} for locating resources.
diff --git a/src/site/apt/dev/release.apt b/src/site/apt/dev/release.apt
index ab9bd52c0..115d07088 100644
--- a/src/site/apt/dev/release.apt
+++ b/src/site/apt/dev/release.apt
@@ -25,15 +25,23 @@ Tiles Release Process
Here you will find the steps to create releases for Tiles.
+ Apache's existing documentation should be read
+
+ * {{{http://www.apache.org/dev/release-publishing}Publishing Releases}}
+
+ * {{{http://www.apache.org/dev/publishing-maven-artifacts.html}Publishing Maven Artifacts}}
+
+ * {{{http://www.apache.org/dev/release}Releases Policy}}
+
Prerequisites
To create a release you have to install:
- * {{{http://java.sun.com/javase/6}Java 6.0}}. If you are using a newer
- version of Java, it is suggested to <>
- when calling Maven, so it points to an instance of Java 6.0;
+ * {{{http://www.oracle.com/technetwork/java/javase/overview/index.html}Java 7}}. If you are using a newer
+ version of Java <>
+ when calling Maven, so it points to an instance of Java 7;
- * {{{http://maven.apache.org/}Maven 2.2 or 3}};
+ * {{{http://maven.apache.org/}Maven 3.0.5+}};
* {{{http://www.gnupg.org/}GnuPG}};
@@ -58,69 +66,11 @@ https://svn.apache.org/repos/asf/tiles/site/KEYS
Publish your GPG key in a PGP key server, such as
{{{http://pgp.mit.edu/} MIT Keyserver}}.
-* Create and upload yout SSH key
-
- * Generate your SSH key (in this case we will use DSA encryption):
-
----------------------------------
-ssh-keygen -t rsa
----------------------------------
-
- * Copy your public key to the server:
-
---------------------------------------
-scp ~/.ssh/id_rsa.pub user@people.apache.org:.ssh/authorized_keys
---------------------------------------
-
- * Try to login:
-
----------------------------------
-ssh user@people.apache.org
----------------------------------
-
- If it does not ask you a password, everything is ok.
-
* Modify <<>>
Your <<>> must be modified to allow deployment.
- This is the minimal configuration, obviously if you already have a <<>> file,
- you must edit it:
-
----------------------------
-
-
-
- apache-site
- YOUR_APACHE_USERNAME
- 664
- 775
-
-
- apache.snapshots.https
- YOUR_APACHE_USERNAME
- YOUR_APACHE_PASSWORD
-
-
- apache.releases.https
- YOUR_APACHE_USERNAME
- YOUR_APACHE_PASSWORD
-
-
-
-
- release
-
- YOUR_SECRET_PHRASE
-
-
-
-
-
----------------------------
+ See {{{http://www.apache.org/dev/publishing-maven-artifacts.html#dev-env}Publishing Maven Artifacts – Setup your development environment}}
Repeatable operations
@@ -132,29 +82,47 @@ Repeatable operations
you are preparing the release and type:
-----------------------------------
+mvn clean
mvn release:prepare -Dusername=YOUR_SVN_USER -Dpassword=YOUR_SVN_PASSWORD
-----------------------------------
The plugin interactively will ask you the version to release, the Subversion
- tag to use and the next snapshot version. It is reccomended to use the tag:
+ tag to use and the next snapshot version. It is recommended to use the tag:
<>.
+ See also {{{http://www.apache.org/dev/publishing-maven-artifacts.html}the recommendations of the ASF}}.
+
* Perform the Release
To perform the release, i.e. creating and deploying Maven artifacts, use:
-----------------------------------
-mvn release:perform
+mvn release:perform -Duser.name=YOUR_PEOPLE_APACHE_SSH_USER -Darguments="-Duser.name=YOUR_PEOPLE_APACHE_SSH_USER"
+-----------------------------------
+
+ It should compile and test everything, build and upload the artifacts and the website for the project.
+
+ Upload the assemblies manually with
+
+-----------------------------------
+cd target/
+svn co https://dist.apache.org/repos/dist/dev/tiles tiles-dist-dev
+mkdir tiles-dist-dev/request/${version}
+cp checkout/assembly/target/assembly/* tiles-dist-dev/${version}/
+svn add tiles-dist-dev/${version}
+svn ci tiles-dist-dev/${version}
-----------------------------------
* Close the staging repository
Login to {{{https://repository.apache.org} Nexus repository}} using your Apache LDAP credentials.
Click on "Staging". Then click on "tiles" in the list of repositories.
+
In the panel below you should see an open repository that is linked to your username and ip.
Right click on this repository and select "Close".
This will close the repository from future deployments and make it available for others to view.
If you are staging multiple releases together, skip this step until you have staged everything.
+
Enter the name and version of the artifact being released in the "Description" field and then click "Close".
This will make it easier to identify it later.
@@ -168,32 +136,11 @@ mvn release:perform
Note the repository URL, you will need this in your vote email.
-* Digest and upload assemblies
-
- * Go into the release assembly target directory:
-
------------------------------------
-cd target/checkout/assembly/target/assembly/out
------------------------------------
-
- * Create MD5 and SHA1 files for each files (including ASC files). You can do
- it with this simple shell script:
+* Verify the uploaded assemblies
------------------------------------
-#!/bin/sh
-
-for fileitem in *
-do
- openssl md5 < $fileitem > $fileitem.md5
- openssl sha1 < $fileitem > $fileitem.sha1
-done
------------------------------------
+ * go to the destination directory on people.apache.org (cd /www/people.apache.org/builds/tiles/${version}).
- * Upload everything to the build site:
-
------------------------------------
-scp * user@people.apache.org:/www/people.apache.org/builds/tiles/${version}
------------------------------------
+ * check the presence of the 3 distributions (bin, doc and src), and their signature files (*.asc, *.md5, *sha1).
* Release the JIRA version
@@ -224,7 +171,7 @@ Release notes:
Distribution:
- * http://people.apache.org/builds/tiles/${version}/
+ * https://dist.apache.org/repos/dist/dev/tiles/${version}/
Maven 2 staging repository:
@@ -250,7 +197,7 @@ Release notes:
Distribution:
- * http://people.apache.org/builds/tiles/${version}/
+ * https://dist.apache.org/repos/dist/dev/tiles/${version}/
Maven 2 staging repository:
@@ -275,28 +222,25 @@ three binding +1s and more +1s than -1s.
After a vote is finished, and it has been decided that is
<>, there is the need of a post-vote process.
-** Promote staged artifacts
+** Promote maven staged artifacts
- Once the release is deemed fit for public consumption it can be transfered to a production repository where it will be available to all users.
+ Once the release is deemed fit for public consumption it can be transfered to a
+ production repository where it will be available to all users.
Login to {{{https://repository.apache.org}Nexus repository}} again.
Click on "Staging" and then on the repository with id "tiles-staging".
- Find your closed staging repository, right click on it and choose "Promote".
- Select the "Releases" repository and click "Promote".
+ Find your closed staging repository, right click on it and choose "Release".
Next click on "Repositories", select the "Releases" repository
and validate that your artifacts exist as you expect them.
-** Move assemblies
+** Publish distribution artifacts
- * Move assemblies to the Apache distribution mirrors:
+ * Move assemblies into the Apache {{{http://www.apache.org/dev/release#when-to-archive}dist}} repository:
-------------------------------------------
-ssh user@people.apache.org
+svn mv https://dist.apache.org/repos/dist/dev/tiles/${version} https://dist.apache.org/repos/dist/release/tiles/
-cd /www/people.apache.org/builds/tiles/${version}
-mkdir /www/www.apache.org/dist/tiles/v${version}/
-cp * /www/www.apache.org/dist/tiles/v${version}/
-------------------------------------------
** Update the site
@@ -312,8 +256,12 @@ https://svn.apache.org/repos/asf/tiles/site/src/site/apt/download.apt
Build and publish the site:
--------------------------------------
-mvn site
-mvn site:deploy
+mvn clean site site:stage
+mvn scm-publish:publish-scm
+# check staging website at target/scmpublish-checkout/index.html
+cd /publish/framework/
+svn merge ^/tiles/site/staging/framework .
+svn ci
--------------------------------------
** Send announcement
@@ -327,18 +275,18 @@ Subject: [ANNOUNCE] Tiles ${version} ${quality} released
The Apache Tiles team is pleased to announce the release of Tiles ${version}
${quality}.
-Tiles ${version} is available in a binary and a source distribution.
+Available in binary and source distribution.
http://tiles.apache.org/download.html
It is also available in the central Maven repository under Group ID
"org.apache.tiles".
-The 2.0.x series of the Apache Tiles framework has a minimum
+The 3.0.x series of the Apache Tiles framework has a minimum
requirement of the following specification versions:
-* Java Servlet 2.4 and JavaServer Pages (JSP) 2.0
-* Java Standard Edition (Java SE) 1.5
+* Java Servlet 2.5 and JavaServer Pages (JSP) 2.1
+* Java Standard Edition (Java SE) 1.7
The release notes are available online at:
@@ -348,4 +296,9 @@ Please feel free to test the distribution and post your comments to
the user list, or, if appropriate, file a ticket with JIRA.
--------------------------------------
+** Delete old releases
+
+ As described in http://www.apache.org/dev/release.html#when-to-archive
+
+
<>
diff --git a/src/site/apt/tutorial/advanced/list-attributes.apt b/src/site/apt/tutorial/advanced/list-attributes.apt
index 588d8b888..a6a58e83f 100644
--- a/src/site/apt/tutorial/advanced/list-attributes.apt
+++ b/src/site/apt/tutorial/advanced/list-attributes.apt
@@ -48,8 +48,9 @@ List Attributes
---------------------------------------
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
+<%@ taglib uri="http://tiles.apache.org/tags-tiles-extras" prefix="tilesx" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
-
+
@@ -93,4 +94,3 @@ List Attributes
* /tiles/credits.jsp
* /tiles/greetings.jsp
-
\ No newline at end of file
diff --git a/src/site/apt/tutorial/advanced/nesting-extending.apt b/src/site/apt/tutorial/advanced/nesting-extending.apt
index 5f91da214..531e298d4 100644
--- a/src/site/apt/tutorial/advanced/nesting-extending.apt
+++ b/src/site/apt/tutorial/advanced/nesting-extending.apt
@@ -24,14 +24,14 @@
Nesting Definitions
Sometimes it is useful to have a structured page with, say, a structured body.
- Tipically, there is a main layout (for example, the "classic" layout) and the
+ Typically, there is a main layout (for example, the "classic" layout) and the
body is made of certain number of sections. In this case, nesting a definition
(the one for the body) inside another definition (the main layout) can be
useful.
* {Named subdefinitions}
- Tiles supports nesting definitions natively. One way of usng nested definitions
+ Tiles supports nesting definitions natively. One way of using nested definitions
is creating a named "subdefinition" and using it as an attribute. For example:
------------------------------------
diff --git a/src/site/apt/tutorial/advanced/wildcard.apt b/src/site/apt/tutorial/advanced/wildcard.apt
index 4b0b24443..6a716b0c2 100644
--- a/src/site/apt/tutorial/advanced/wildcard.apt
+++ b/src/site/apt/tutorial/advanced/wildcard.apt
@@ -26,9 +26,64 @@ Wildcard support
By default, Tiles supports wildcards in definition names. Wilcards help a
lot in writing less code to declare your definitions.
- There are two styles:
+* Default configuration
- * the wildcard-based style (available by default):
+ Note: default configuration only works if you do not use <<>>. If you are using this setting, you can move to the next section.
+
+ Let us start with a simple example. When not using wildcards, you might end up with such tiles definitions:
+
+-----------------------------------
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+------------------------------------
+
+ The above definitions are pretty verbose as you need to create one definition per JSP that you're adding to your application.
+ You could use definition inheritance to reduce the number of lines but you would still need one definition per JSP.
+
+
+** Single star '\*'
+
+ Let's see how to improve that using wildcards. You would then have:
+
+------------------------------------
+
+
+
+
+
+------------------------------------
+ Calling a view named "bank/user" matches the above definition name. Inside the "body" attributes, \{1\} refers to the star's value which is "user" in that case.
+
+
+** Multiple stars such as in '\*/\*'
+
+ Let's now consider another case. As you can see, the sample below uses 2 stars '\*'.
+
+------------------------------------
+
+
+
+
+
+------------------------------------
+
+ Calling a view named "/bank/customer/account" matches the above definition name.
+ Inside the 'body' attribute, \{1\} refers to the first star and \{2\} refers to the second one.
+ The "body" JSP name will be "customer-account.jsp".
+
+ Here is another example which shows that you can use package-style definition names:
------------------------------------
@@ -38,29 +93,64 @@ Wildcard support
------------------------------------
-* {Using different pattern matching languages}
- If you're using the <<>>, you must use a predix to specify
- the pattern matching language you're using: either WILDCARD or REGEXP:
+* Using prefixes
+
+** Enabling CompleteAutoloadTilesContainerFactory
+
+ As a prerequisite for using prefixes, you need to have CompleteAutoloadTilesContainerFactory enabled.
+
+ If you haven't enabled it yet, here is a quick checklist for you to use.
+
+ The library tiles-extras is required. If you're using Maven, you need to add this dependency to you POM file:
+
------------------------------------
-
+
+ org.apache.tiles
+ tiles-extras
+ 3.0.1
+
+------------------------------------
+
+ If you are using Spring, you should add the 'completeAutoload' attribute to your TilesConfigurer bean.
+
+------------------------------------
+
+
+
+------------------------------------
+
+** Using prefixes
+
+ Here is an example of prefix using Regular Expressions:
+
+------------------------------------
+
------------------------------------
- And, if you want to use Regular Expressions:
+ The below sample uses WILDCARD (this prefix is not needed when using wildcards solely, as shown in the 'Default Configuration' section).
------------------------------------
-
+
+
+
+
+
+
------------------------------------
+
+* tiles:insertDefinition
+
In both cases, if you insert a definition that matches the definition, for example:
------------------------------------
@@ -76,4 +166,4 @@ Wildcard support
-------------------------------------
+------------------------------------
\ No newline at end of file
diff --git a/src/site/apt/tutorial/configuration.apt b/src/site/apt/tutorial/configuration.apt
index 05b9b745e..f72a61de0 100644
--- a/src/site/apt/tutorial/configuration.apt
+++ b/src/site/apt/tutorial/configuration.apt
@@ -37,7 +37,7 @@ Configuring Tiles in your web application
-------------
org.apache.tiles
-tiles-extras
+tiles-extras
-------------
If you're not using maven, just {{{/download.html}download}} tiles and copy all the jars
diff --git a/src/site/apt/tutorial/integration/frameworks.apt b/src/site/apt/tutorial/integration/frameworks.apt
index e64ec44e0..722af8540 100644
--- a/src/site/apt/tutorial/integration/frameworks.apt
+++ b/src/site/apt/tutorial/integration/frameworks.apt
@@ -25,17 +25,19 @@ Integration with other web Frameworks
Tiles can be integrated with other web frameworks. Usually this kind of
integration is made through extensions/plugins to Tiles.
-
+
* {{{http://struts.apache.org/1.x/index.html}Struts 1}}: Currently under
development. A Struts 1 plugin is available in the SVN trunk, that presumably
will be released along with Struts 1.4.
-
- * {{{http://struts.apache.org/2.x/docs/tiles-plugin.html}Struts 2}}: at the time of this
+
+ * {{{http://struts.apache.org/development/2.x/struts2-plugins/struts2-tiles-plugin/apidocs/index.html}Struts 2}}: at the time of this
writing, the Struts 2 Tiles plugin still uses Tiles version 2.
-
- * {{{http://static.springsource.org/spring/docs/current/spring-framework-reference/html/view.html#view-tiles}Spring MVC}}:
- At the time of this writing, Spring uses Tiles version 2.
-
- * {{{http://shale.apache.org/shale-tiles/index.html}Shale}}: An integration
- layer is provided, but it needs to be updated to the latest released version
- of Tiles.
+
+ * {{{http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/view.html#view-tiles}Spring MVC}}:
+ Spring-3.2 can integration up to Tiles-2 and Tiles-3.
+
+
+
+ For a closer look at custom integrations the
+ {{{https://github.com/spring-projects/spring-framework/tree/v3.2.0.RELEASE/spring-webmvc-tiles3/src/main/java/org/springframework/web/servlet/view/tiles3}spring code}}:
+ forms a good example.
diff --git a/src/site/apt/tutorial/integration/view.apt b/src/site/apt/tutorial/integration/view.apt
index 170015b50..3a02f867d 100644
--- a/src/site/apt/tutorial/integration/view.apt
+++ b/src/site/apt/tutorial/integration/view.apt
@@ -29,3 +29,5 @@ Integration with other View Technologies
* {{{./freemarker.html}FreeMarker}}.
* {{{./velocity.html}Velocity}}.
+
+ * Mustache.
diff --git a/src/site/site.xml b/src/site/site.xml
index ab8686e82..bea45012d 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -22,39 +22,62 @@
*/
-->
+
+ org.apache.maven.skins
+ maven-fluido-skin
+ 1.3.0
+
+
+
+ true
+ false
+ true
+
+ apache/tiles
+ right
+ darkblue
+
+
+
- Apache Software Foundation
- http://www.apache.org/images/asf-logo.gif
- http://www.apache.org
-
- Apache Tiles™http://tiles.apache.org/images/logo.pnghttp://tiles.apache.org
+
+
+ Apache Software Foundation
+ http://www.apache.org
+ https://tiles.apache.org/images/logos/asf_logo_url.svg
-
-
-
-
-
-
-
diff --git a/src/site/xdoc/dev/building.xml b/src/site/xdoc/dev/building.xml
index 7fb099a03..700ae4f1a 100644
--- a/src/site/xdoc/dev/building.xml
+++ b/src/site/xdoc/dev/building.xml
@@ -83,10 +83,10 @@
checkout the site from the source repository:
svn co http://svn.apache.org/repos/asf/tiles/site/
go into the site directory and type:
-
mvn site
+
mvn clean site site:stage
You will find the generated distribution under
- {tiles-site-dir}/target/site.
+ {tiles-site-dir}/target/staging.
To build the framework website:
@@ -95,7 +95,7 @@
distribution, or checkout the latest version:
svn co http://svn.apache.org/repos/asf/tiles/framework/trunk/tiles-parent/
go into the source directory and type:
-
mvn site site:stage
+
mvn clean site site:stage
You will find the generated website under:
diff --git a/tiles-api/pom.xml b/tiles-api/pom.xml
index 56bee5b32..7f2735fba 100644
--- a/tiles-api/pom.xml
+++ b/tiles-api/pom.xml
@@ -26,7 +26,7 @@
org.apache.tilestiles-parent
- 3.0.0-SNAPSHOT
+ 3.0.9-SNAPSHOT4.0.0
@@ -74,16 +74,15 @@
junitjunittest
-
+
org.easymockeasymockclassextensiontest
-
+
- org.slf4j
- slf4j-jdk14
- true
+ org.slf4j
+ slf4j-apiorg.apache.tiles
diff --git a/tiles-api/src/site/site.xml b/tiles-api/src/site/site.xml
index 34d95ef19..beaec78a7 100644
--- a/tiles-api/src/site/site.xml
+++ b/tiles-api/src/site/site.xml
@@ -22,19 +22,64 @@
*/
-->
+
+ org.apache.maven.skins
+ maven-fluido-skin
+ 1.3.0
+
+
+
+ true
+ false
+ true
+
+ apache/tiles
+ right
+ darkblue
+
+
+
+
+ Apache Tiles™
+ http://tiles.apache.org/images/logo.png
+ http://tiles.apache.org
+
+
+ Apache Software Foundation
+ http://struts.apache.org/images/asf-logo.gif
+ http://www.apache.org
+
+ name="Tiles 3.0.x"
+ href="../../framework/index.html"/>
+
+
+
+
+
diff --git a/tiles-compat/pom.xml b/tiles-compat/pom.xml
index 681e18262..e071d2a3d 100644
--- a/tiles-compat/pom.xml
+++ b/tiles-compat/pom.xml
@@ -26,7 +26,7 @@
org.apache.tilestiles-parent
- 3.0.0-SNAPSHOT
+ 3.0.9-SNAPSHOT4.0.0
@@ -89,8 +89,7 @@
org.slf4j
- slf4j-jdk14
- true
+ slf4j-api
diff --git a/tiles-compat/src/site/site.xml b/tiles-compat/src/site/site.xml
index e2c7a3d18..7c9841a74 100644
--- a/tiles-compat/src/site/site.xml
+++ b/tiles-compat/src/site/site.xml
@@ -22,19 +22,64 @@
*/
-->
+
+ org.apache.maven.skins
+ maven-fluido-skin
+ 1.3.0
+
+
+
+ true
+ false
+ true
+
+ apache/tiles
+ right
+ darkblue
+
+
+
+
+ Apache Tiles™
+ http://tiles.apache.org/images/logo.png
+ http://tiles.apache.org
+
+
+ Apache Software Foundation
+ http://struts.apache.org/images/asf-logo.gif
+ http://www.apache.org
+
+ name="Tiles 3.0.x"
+ href="../../framework/index.html"/>
+
+
+
+
+
diff --git a/tiles-core/pom.xml b/tiles-core/pom.xml
index befbeec4a..93ed798bb 100644
--- a/tiles-core/pom.xml
+++ b/tiles-core/pom.xml
@@ -26,7 +26,7 @@
org.apache.tilestiles-parent
- 3.0.0-SNAPSHOT
+ 3.0.9-SNAPSHOT4.0.0
@@ -93,8 +93,7 @@
org.slf4j
- slf4j-jdk14
- true
+ slf4j-api
diff --git a/tiles-core/src/main/java/org/apache/tiles/definition/dao/CachingLocaleUrlDefinitionDAO.java b/tiles-core/src/main/java/org/apache/tiles/definition/dao/CachingLocaleUrlDefinitionDAO.java
index 542d8d747..20f13db8d 100644
--- a/tiles-core/src/main/java/org/apache/tiles/definition/dao/CachingLocaleUrlDefinitionDAO.java
+++ b/tiles-core/src/main/java/org/apache/tiles/definition/dao/CachingLocaleUrlDefinitionDAO.java
@@ -166,10 +166,15 @@ protected Definition getDefinitionFromResolver(String name,
* @return The loaded definitions.
* @since 2.1.0
*/
- protected synchronized Map checkAndloadDefinitions(
- Locale customizationKey) {
+ protected synchronized Map checkAndloadDefinitions(Locale customizationKey) {
+ Map existingDefinitions = locale2definitionMap.get(customizationKey);
+ boolean definitionsAlreadyLoaded = existingDefinitions != null;
+ if (definitionsAlreadyLoaded) {
+ return existingDefinitions;
+ }
if (checkRefresh && refreshRequired()) {
locale2definitionMap.clear();
+ definitionResolver.clearPatternPaths(customizationKey);
}
loadDefinitions(customizationKey);
return locale2definitionMap.get(customizationKey);
diff --git a/tiles-core/src/main/java/org/apache/tiles/definition/pattern/AbstractPatternDefinitionResolver.java b/tiles-core/src/main/java/org/apache/tiles/definition/pattern/AbstractPatternDefinitionResolver.java
index 65ff73d0f..50bc8f74b 100644
--- a/tiles-core/src/main/java/org/apache/tiles/definition/pattern/AbstractPatternDefinitionResolver.java
+++ b/tiles-core/src/main/java/org/apache/tiles/definition/pattern/AbstractPatternDefinitionResolver.java
@@ -106,4 +106,17 @@ private Definition searchAndResolveDefinition(
return d;
}
+
+
+ /**
+ * Used to clear all entries in the localePatternPaths for a specific locale. Necessary when reloading definition
+ * files to ensure that the list is cleared first
+ *
+ * @param customizationKey
+ */
+ @Override
+ public void clearPatternPaths(T customizationKey) {
+ if (localePatternPaths.get(customizationKey) != null)
+ localePatternPaths.get(customizationKey).clear();
+ }
}
diff --git a/tiles-core/src/main/java/org/apache/tiles/definition/pattern/PatternDefinitionResolver.java b/tiles-core/src/main/java/org/apache/tiles/definition/pattern/PatternDefinitionResolver.java
index 539f8ddea..2cf3d4b9c 100644
--- a/tiles-core/src/main/java/org/apache/tiles/definition/pattern/PatternDefinitionResolver.java
+++ b/tiles-core/src/main/java/org/apache/tiles/definition/pattern/PatternDefinitionResolver.java
@@ -57,4 +57,12 @@ Map storeDefinitionPatterns(Map localeDe
* @since 2.2.0
*/
Definition resolveDefinition(String name, T customizationKey);
+
+ /**
+ * Used to clear all entries in the localePatternPaths for a specific locale. Necessary when reloading definition
+ * files to ensure that the list is cleared first
+ *
+ * @param customizationKey
+ */
+ public void clearPatternPaths(T customizationKey);
}
diff --git a/tiles-core/src/main/java/org/apache/tiles/definition/pattern/PatternUtil.java b/tiles-core/src/main/java/org/apache/tiles/definition/pattern/PatternUtil.java
index 569416e72..944489718 100644
--- a/tiles-core/src/main/java/org/apache/tiles/definition/pattern/PatternUtil.java
+++ b/tiles-core/src/main/java/org/apache/tiles/definition/pattern/PatternUtil.java
@@ -22,6 +22,7 @@
package org.apache.tiles.definition.pattern;
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
@@ -51,7 +52,7 @@ public final class PatternUtil {
/** Pattern to find {.*} occurrences that do not match {[0-9]+} so to prevent MessageFormat from crashing.
*/
- private static final Pattern INVALID_FORMAT_ELEMENT = Pattern.compile("\\Q{\\E[\\D^}]+\\Q}\\E");
+ private static final Pattern INVALID_FORMAT_ELEMENT = Pattern.compile("\\{[^}0-9]+\\}");
/**
* Private constructor to avoid instantiation.
@@ -66,12 +67,15 @@ private PatternUtil() {
*
* @param d The definition to replace.
* @param name The name of the definition to be created.
- * @param vars The variables to be substituted.
+ * @param varsOrig The variables to be substituted.
* @return The definition that can be rendered.
* @since 2.2.0
*/
public static Definition replacePlaceholders(Definition d, String name,
- Object... vars) {
+ Object... varsOrig) {
+
+ Object[] vars = replaceNullsWithBlank(varsOrig);
+
Definition nudef = new Definition();
nudef.setExtends(replace(d.getExtends(), vars));
@@ -209,18 +213,31 @@ private static Attribute replaceVarsInListAttribute(ListAttribute listAttr,
*/
private static String replace(String st, Object... vars) {
if (st != null && st.indexOf('{') >= 0) {
- // remember the invalid "{...}" occurrences
- Matcher m = INVALID_FORMAT_ELEMENT.matcher(st);
+
// replace them with markers
- st = INVALID_FORMAT_ELEMENT.matcher(st).replaceAll("INVALID_FORMAT_ELEMENT");
+ List originals = new ArrayList();
+ for(Matcher m = INVALID_FORMAT_ELEMENT.matcher(st); m.find() ; m = INVALID_FORMAT_ELEMENT.matcher(st)) {
+ originals.add(m.group());
+ st = m.replaceFirst("INVALID_FORMAT_ELEMENT");
+ }
+
// do the MessageFormat replacement (escaping quote characters)
st = new MessageFormat(st.replaceAll("'", "'''"), ROOT_LOCALE)
.format(vars, new StringBuffer(), null).toString();
+
// return the markers to their original invalid occurrences
- while (m.find()) {
- st = st.replace("INVALID_FORMAT_ELEMENT", m.group());
+ for (String original : originals) {
+ st = st.replaceFirst("INVALID_FORMAT_ELEMENT", original);
}
}
return st;
}
+
+ private static Object[] replaceNullsWithBlank(Object[] varsOrig) {
+ Object[] vars = new Object[varsOrig.length];
+ for(int i = 0; i < varsOrig.length; ++i) {
+ vars[i] = null != varsOrig[i] ? varsOrig[i] : "";
+ }
+ return vars;
+ }
}
diff --git a/tiles-core/src/main/java/org/apache/tiles/preparer/factory/BasicPreparerFactory.java b/tiles-core/src/main/java/org/apache/tiles/preparer/factory/BasicPreparerFactory.java
index c9d46cde0..e116c87a7 100644
--- a/tiles-core/src/main/java/org/apache/tiles/preparer/factory/BasicPreparerFactory.java
+++ b/tiles-core/src/main/java/org/apache/tiles/preparer/factory/BasicPreparerFactory.java
@@ -20,8 +20,10 @@
*/
package org.apache.tiles.preparer.factory;
-import java.util.HashMap;
+import java.util.Collections;
import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import org.apache.tiles.preparer.ViewPreparer;
import org.apache.tiles.request.Request;
@@ -49,12 +51,14 @@ public class BasicPreparerFactory implements PreparerFactory {
* Maps a preparer name to the instantiated preparer.
*/
protected Map preparers;
+ protected Set knownPreparers;
/**
* Constructor.
*/
public BasicPreparerFactory() {
- this.preparers = new HashMap();
+ this.preparers = new ConcurrentHashMap();
+ this.knownPreparers = Collections.newSetFromMap(new ConcurrentHashMap());
}
@@ -68,8 +72,12 @@ public BasicPreparerFactory() {
*/
public ViewPreparer getPreparer(String name, Request context) {
- if (!preparers.containsKey(name)) {
- preparers.put(name, createPreparer(name));
+ if (!knownPreparers.contains(name)) {
+ knownPreparers.add(name);
+ ViewPreparer preparer = createPreparer(name);
+ if (preparer != null) {
+ preparers.put(name, preparer);
+ }
}
return preparers.get(name);
diff --git a/tiles-core/src/site/site.xml b/tiles-core/src/site/site.xml
index 7f5d6c626..6cf638680 100644
--- a/tiles-core/src/site/site.xml
+++ b/tiles-core/src/site/site.xml
@@ -22,19 +22,64 @@
*/
-->
+
+ org.apache.maven.skins
+ maven-fluido-skin
+ 1.3.0
+
+
+
+ true
+ false
+ true
+
+ apache/tiles
+ right
+ darkblue
+
+
+
+
+ Apache Tiles™
+ http://tiles.apache.org/images/logo.png
+ http://tiles.apache.org
+
+
+ Apache Software Foundation
+ http://struts.apache.org/images/asf-logo.gif
+ http://www.apache.org
+
+ name="Tiles 3.0.x"
+ href="../../framework/index.html"/>
+
+
+
+
+
diff --git a/tiles-core/src/test/java/org/apache/tiles/definition/pattern/AbstractPatternDefinitionResolverTest.java b/tiles-core/src/test/java/org/apache/tiles/definition/pattern/AbstractPatternDefinitionResolverTest.java
index 10a39a802..a564e375a 100644
--- a/tiles-core/src/test/java/org/apache/tiles/definition/pattern/AbstractPatternDefinitionResolverTest.java
+++ b/tiles-core/src/test/java/org/apache/tiles/definition/pattern/AbstractPatternDefinitionResolverTest.java
@@ -40,60 +40,70 @@
*/
public class AbstractPatternDefinitionResolverTest {
+ private DefinitionPatternMatcher firstMatcher;
+ private DefinitionPatternMatcher thirdMatcher;
+
+ private final PatternDefinitionResolver resolver = new AbstractPatternDefinitionResolver() {
+ @Override
+ protected Map addDefinitionsAsPatternMatchers(
+ List matchers,
+ Map defsMap) {
+
+ if (defsMap.containsKey("first")) {
+ matchers.add(firstMatcher);
+ }
+ if (defsMap.containsKey("third")) {
+ matchers.add(thirdMatcher);
+ }
+ Map retValue = new HashMap(defsMap);
+ retValue.remove("first");
+ retValue.remove("third");
+ return retValue;
+ }
+ };
+
/**
* Test method for
* {@link BasicPatternDefinitionResolver#resolveDefinition(String, Object)}.
*/
@Test
public void testResolveDefinition() {
- final DefinitionPatternMatcher firstMatcher = createMock(DefinitionPatternMatcher.class);
- final DefinitionPatternMatcher thirdMatcher = createMock(DefinitionPatternMatcher.class);
-
- Definition firstDefinition = new Definition("first", (Attribute) null,
- null);
- Definition secondDefinition = new Definition("second",
- (Attribute) null, null);
- Definition thirdDefinition = new Definition("third", (Attribute) null,
- null);
-
- Definition firstTransformedDefinition = new Definition(
- "firstTransformed", (Attribute) null, null);
- Definition thirdTransformedDefinition = new Definition(
- "thirdTransformed", (Attribute) null, null);
-
- expect(firstMatcher.createDefinition("firstTransformed")).andReturn(
- firstTransformedDefinition);
- expect(firstMatcher.createDefinition("secondTransformed")).andReturn(
- null);
- expect(firstMatcher.createDefinition("thirdTransformed")).andReturn(
- null);
- expect(thirdMatcher.createDefinition("thirdTransformed")).andReturn(
- thirdTransformedDefinition).times(2);
- expect(thirdMatcher.createDefinition("firstTransformed")).andReturn(
- null);
- expect(thirdMatcher.createDefinition("secondTransformed")).andReturn(
- null).times(2);
+ testResolveDefinitionImpl();
+ }
+
+ /**
+ * Test method for
+ * {@link BasicPatternDefinitionResolver#clearPatternPaths(Object)}.
+ */
+ @Test
+ public void testClearPatternPaths() {
+ testResolveDefinitionImpl();
+ resolver.clearPatternPaths(1);
+ resolver.clearPatternPaths(2);
+ testResolveDefinitionImpl();
+ }
+
+ private void testResolveDefinitionImpl() {
+
+ firstMatcher = createMock(DefinitionPatternMatcher.class);
+ thirdMatcher = createMock(DefinitionPatternMatcher.class);
+
+ Definition firstDefinition = new Definition("first", (Attribute) null, null);
+ Definition secondDefinition = new Definition("second", (Attribute) null, null);
+ Definition thirdDefinition = new Definition("third", (Attribute) null, null);
+
+ Definition firstTransformedDefinition = new Definition("firstTransformed", (Attribute) null, null);
+ Definition thirdTransformedDefinition = new Definition("thirdTransformed", (Attribute) null, null);
+
+ expect(firstMatcher.createDefinition("firstTransformed")).andReturn(firstTransformedDefinition);
+ expect(firstMatcher.createDefinition("secondTransformed")).andReturn(null);
+ expect(firstMatcher.createDefinition("thirdTransformed")).andReturn(null);
+ expect(thirdMatcher.createDefinition("thirdTransformed")).andReturn(thirdTransformedDefinition).times(2);
+ expect(thirdMatcher.createDefinition("firstTransformed")).andReturn(null);
+ expect(thirdMatcher.createDefinition("secondTransformed")).andReturn(null).times(2);
replay(firstMatcher, thirdMatcher);
- PatternDefinitionResolver resolver = new AbstractPatternDefinitionResolver() {
-
- @Override
- protected Map addDefinitionsAsPatternMatchers(
- List matchers,
- Map defsMap) {
- if (defsMap.containsKey("first")) {
- matchers.add(firstMatcher);
- }
- if (defsMap.containsKey("third")) {
- matchers.add(thirdMatcher);
- }
- Map retValue = new HashMap(defsMap);
- retValue.remove("first");
- retValue.remove("third");
- return retValue;
- }
- };
Map localeDefsMap = new LinkedHashMap();
localeDefsMap.put("first", firstDefinition);
localeDefsMap.put("second", secondDefinition);
diff --git a/tiles-core/src/test/java/org/apache/tiles/definition/pattern/PatternUtilTest.java b/tiles-core/src/test/java/org/apache/tiles/definition/pattern/PatternUtilTest.java
index 66218db00..17a5cf07a 100644
--- a/tiles-core/src/test/java/org/apache/tiles/definition/pattern/PatternUtilTest.java
+++ b/tiles-core/src/test/java/org/apache/tiles/definition/pattern/PatternUtilTest.java
@@ -185,15 +185,138 @@ public void testCreateExtractedMap() {
* See TILES-502
*/
@Test
- public void testReplacePlaceholdersEL() {
+ public void testReplacePlaceholdersEL_0() {
Map attributes = new HashMap();
- attributes.put("something", new Attribute("some-{1}-${requestScope.someVariable}.jsp"));
- Definition definition = new Definition("definitionName", new Attribute(
- "template"), attributes);
- Definition nudef = PatternUtil.replacePlaceholders(definition, "nudef",
- "value0", "value1", "value2", "value3");
+ Attribute attribute = new Attribute("some-{1}-${requestScope.someVariable}.jsp");
+ attribute.setExpressionObject(new Expression((String)attribute.getValue()));
+ attributes.put("something", attribute);
+ Definition definition = new Definition("definitionName", new Attribute("template"), attributes);
+ Definition nudef = PatternUtil.replacePlaceholders(definition, "nudef", "value0", "value1", "value2", "value3");
+ assertEquals("nudef", nudef.getName());
+
+ assertEquals(
+ "some-value1-${requestScope.someVariable}.jsp",
+ nudef.getAttribute("something").getValue());
+
+ assertEquals(
+ "some-value1-${requestScope.someVariable}.jsp",
+ nudef.getAttribute("something").getExpressionObject().getExpression());
+ }
+
+ /**
+ * Test method for
+ * {@link PatternUtil#replacePlaceholders(Definition, String, Object[])}.
+ * See TILES-574
+ */
+ @Test
+ public void testReplacePlaceholdersEL_1() {
+ Map attributes = new HashMap();
+ Attribute attribute = new Attribute("some-{1}-${requestScope.someVariable}-other-{2}.jsp");
+ attribute.setExpressionObject(new Expression((String)attribute.getValue()));
+ attributes.put("something", attribute);
+ Definition definition = new Definition("definitionName", new Attribute("template"), attributes);
+ Definition nudef = PatternUtil.replacePlaceholders(definition, "nudef", "value0", "value1", "value2", "value3");
+ assertEquals("nudef", nudef.getName());
+
+ assertEquals(
+ "some-value1-${requestScope.someVariable}-other-value2.jsp",
+ nudef.getAttribute("something").getValue());
+
+ assertEquals(
+ "some-value1-${requestScope.someVariable}-other-value2.jsp",
+ nudef.getAttribute("something").getExpressionObject().getExpression());
+ }
+
+ /**
+ * Test method for
+ * {@link PatternUtil#replacePlaceholders(Definition, String, Object[])}.
+ * See TILES-574
+ */
+ @Test
+ public void testReplacePlaceholdersEL_2() {
+ Map attributes = new HashMap();
+ Attribute attribute = new Attribute("some-${requestScope.someVariable}-other-{1}-${requestScope.someOtherVariable}.jsp");
+ attribute.setExpressionObject(new Expression((String)attribute.getValue()));
+ attributes.put("something", attribute);
+ Definition definition = new Definition("definitionName", new Attribute("template"), attributes);
+ Definition nudef = PatternUtil.replacePlaceholders(definition, "nudef", "value0", "value1", "value2", "value3");
+ assertEquals("nudef", nudef.getName());
+
+ assertEquals(
+ "some-${requestScope.someVariable}-other-value1-${requestScope.someOtherVariable}.jsp",
+ nudef.getAttribute("something").getValue());
+
+ assertEquals(
+ "some-${requestScope.someVariable}-other-value1-${requestScope.someOtherVariable}.jsp",
+ nudef.getAttribute("something").getExpressionObject().getExpression());
+ }
+
+ /**
+ * Test method for
+ * {@link PatternUtil#replacePlaceholders(Definition, String, Object[])}.
+ */
+ @Test
+ public void testReplacePlaceholdersEL_conditional() {
+ Map attributes = new HashMap();
+ Attribute attribute = new Attribute("{1}/some-other-{2}-${requestScope.someBoolean ? 'a' : 'b'}.jsp");
+ attribute.setExpressionObject(new Expression((String)attribute.getValue()));
+ attributes.put("something", attribute);
+ Definition definition = new Definition("definitionName", new Attribute("template"), attributes);
+ Definition nudef = PatternUtil.replacePlaceholders(definition, "nudef", "value0", "value1", "value2", "value3");
+ assertEquals("nudef", nudef.getName());
+
+ assertEquals(
+ "value1/some-other-value2-${requestScope.someBoolean ? 'a' : 'b'}.jsp",
+ nudef.getAttribute("something").getValue());
+
+ assertEquals(
+ "value1/some-other-value2-${requestScope.someBoolean ? 'a' : 'b'}.jsp",
+ nudef.getAttribute("something").getExpressionObject().getExpression());
+ }
+
+ /**
+ * Test method for
+ * {@link PatternUtil#replacePlaceholders(Definition, String, Object[])}.
+ */
+ @Test
+ public void testReplacePlaceholdersEL_twice() {
+ Map attributes = new HashMap();
+ Attribute attribute = new Attribute("some-${requestScope.firstVariable}-${requestScope.secondVariable}.jsp");
+ attribute.setExpressionObject(new Expression((String)attribute.getValue()));
+ attributes.put("something", attribute);
+ Definition definition = new Definition("definitionName", new Attribute("template"), attributes);
+ Definition nudef = PatternUtil.replacePlaceholders(definition, "nudef", "value0", "value1", "value2", "value3");
assertEquals("nudef", nudef.getName());
- Attribute attribute = nudef.getAttribute("something");
- assertEquals("some-value1-${requestScope.someVariable}.jsp", attribute.getValue());
+
+ assertEquals(
+ "some-${requestScope.firstVariable}-${requestScope.secondVariable}.jsp",
+ nudef.getAttribute("something").getValue());
+
+ assertEquals(
+ "some-${requestScope.firstVariable}-${requestScope.secondVariable}.jsp",
+ nudef.getAttribute("something").getExpressionObject().getExpression());
+ }
+
+ /**
+ * Test method for
+ * {@link PatternUtil#replacePlaceholders(Definition, String, Object[])}.
+ */
+ @Test
+ public void testReplacePlaceholdersEL_options() {
+ Map attributes = new HashMap();
+ Attribute attribute = new Attribute("{1}/{options[my_fallback}}/some-other-{2}-${requestScope.someVariable}.jsp");
+ attribute.setExpressionObject(new Expression((String)attribute.getValue()));
+ attributes.put("something", attribute);
+ Definition definition = new Definition("definitionName", new Attribute("template"), attributes);
+ Definition nudef = PatternUtil.replacePlaceholders(definition, "nudef", "value0", "value1", "value2", "value3");
+ assertEquals("nudef", nudef.getName());
+
+ assertEquals(
+ "value1/{options[my_fallback}}/some-other-value2-${requestScope.someVariable}.jsp",
+ nudef.getAttribute("something").getValue());
+
+ assertEquals(
+ "value1/{options[my_fallback}}/some-other-value2-${requestScope.someVariable}.jsp",
+ nudef.getAttribute("something").getExpressionObject().getExpression());
}
}
diff --git a/tiles-el/pom.xml b/tiles-el/pom.xml
index 7c4d7e3a5..bb1a9349f 100644
--- a/tiles-el/pom.xml
+++ b/tiles-el/pom.xml
@@ -19,7 +19,7 @@
org.apache.tilestiles-parent
- 3.0.0-SNAPSHOT
+ 3.0.9-SNAPSHOT4.0.0
@@ -61,17 +61,17 @@
-
- org.apache.felix
- maven-bundle-plugin
-
-
-
- org.apache.el; resolution:=optional,
- *
-
-
-
+
+ org.apache.felix
+ maven-bundle-plugin
+
+
+
+ org.apache.el; resolution:=optional,
+ *
+
+
+
@@ -85,8 +85,7 @@
org.slf4j
- slf4j-jdk14
- true
+ slf4j-api
diff --git a/tiles-el/src/site/site.xml b/tiles-el/src/site/site.xml
index 6a9ce8c8f..ec3b4ec03 100644
--- a/tiles-el/src/site/site.xml
+++ b/tiles-el/src/site/site.xml
@@ -22,19 +22,64 @@
*/
-->
+
+ org.apache.maven.skins
+ maven-fluido-skin
+ 1.3.0
+
+
+
+ true
+ false
+ true
+
+ apache/tiles
+ right
+ darkblue
+
+
+
+
+ Apache Tiles™
+ http://tiles.apache.org/images/logo.png
+ http://tiles.apache.org
+
+
+ Apache Software Foundation
+ http://struts.apache.org/images/asf-logo.gif
+ http://www.apache.org
+
+ name="Tiles 3.0.x"
+ href="../../framework/index.html"/>
+
+
+
+
+
diff --git a/tiles-extras/pom.xml b/tiles-extras/pom.xml
index ee8fb08b9..5fd7ffec5 100644
--- a/tiles-extras/pom.xml
+++ b/tiles-extras/pom.xml
@@ -26,7 +26,7 @@
org.apache.tilestiles-parent
- 3.0.0-SNAPSHOT
+ 3.0.9-SNAPSHOT4.0.0
@@ -111,6 +111,12 @@
${project.version}
+
+ guava
+ com.google.guava
+ 12.0.1
+
+
javax.servletservlet-api
@@ -131,8 +137,7 @@
org.slf4j
- slf4j-jdk14
- true
+ slf4j-api
diff --git a/tiles-extras/src/main/java/org/apache/tiles/extras/renderer/OptionsRenderer.java b/tiles-extras/src/main/java/org/apache/tiles/extras/renderer/OptionsRenderer.java
index 49b3151eb..513259865 100644
--- a/tiles-extras/src/main/java/org/apache/tiles/extras/renderer/OptionsRenderer.java
+++ b/tiles-extras/src/main/java/org/apache/tiles/extras/renderer/OptionsRenderer.java
@@ -20,14 +20,16 @@
*/
package org.apache.tiles.extras.renderer;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
import org.apache.tiles.Attribute;
import org.apache.tiles.ListAttribute;
import org.apache.tiles.access.TilesAccess;
@@ -40,34 +42,45 @@
/**
* Provides a custom "options" syntax for attributes.
* The first option that can be rendered is.
- * Comes from http://tech.finn.no/the-ultimate-view/
+ * Comes from The Ultimate View article.
*
- * Actual rendering is delegated to the TypeDetectingRenderer that's supplied in the constructor.
+ * Actual rendering is delegated to the TypeDetectingRenderer that's supplied in the constructor.
*
* For example:
* "/WEB-INF/tiles/fragments/${options[myoptions]}/content.jsp"
* given the myptions list-attribute is defined like:
*