You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2007/02/21 18:18:54 UTC
svn commit: r510105 - in
/tapestry/tapestry5/tapestry-simple/trunk/src/main/resources: META-INF/
archetype-resources/ archetype-resources/src/main/java/pages/
archetype-resources/src/main/java/services/
archetype-resources/src/main/resources/ archetype...
Author: hlship
Date: Wed Feb 21 09:18:52 2007
New Revision: 510105
URL: http://svn.apache.org/viewvc?view=rev&rev=510105
Log:
Remove the index.html (no longer necessary, and gets in the way for some servlet containers).
Add additional documentation.
Configure the new project to use TestNG as a dependency (to keep surefire happy).
Configure the new project to use the archiveClasses option when packaging the WAR; this keeps Tomcat (and JBoss, and probably others) happy, and allows Tapestry to locate component classes at runtime.
[TAPESTRY-1287]
Removed:
tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/webapp/index.html
Modified:
tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/META-INF/archetype.xml
tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/pom.xml
tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/java/pages/Start.java
tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/java/services/AppModule.java
tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/resources/log4j.properties
tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/Start.html
tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
Modified: tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/META-INF/archetype.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/META-INF/archetype.xml?view=diff&rev=510105&r1=510104&r2=510105
==============================================================================
--- tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/META-INF/archetype.xml (original)
+++ tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/META-INF/archetype.xml Wed Feb 21 09:18:52 2007
@@ -3,7 +3,6 @@
<resources>
<resource>.classpath</resource>
<resource>.project</resource>
- <resource>src/main/webapp/index.html</resource>
<resource>src/main/webapp/WEB-INF/web.xml</resource>
<resource>src/main/webapp/WEB-INF/Start.html</resource>
<resource>src/main/resources/log4j.properties</resource>
Modified: tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/pom.xml?view=diff&rev=510105&r1=510104&r2=510105
==============================================================================
--- tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/pom.xml (original)
+++ tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/pom.xml Wed Feb 21 09:18:52 2007
@@ -1,4 +1,5 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
@@ -12,13 +13,29 @@
<artifactId>tapestry-core</artifactId>
<version>${tapestry-release-version}</version>
</dependency>
- <!-- This can be removed if not desired. Tapestry uses commons-logging, not Log4J explicitly. -->
+
+ <!-- This can be removed if not desired. Tapestry uses commons-logging, not Log4J explicitly.
+ However, if Log4J is not on the classpath, commons-logging tends to use its own internal
+ logging which is not very configurable. This project includes a log4j.properties file
+ to configure output. -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.9</version>
- </dependency>
- </dependencies>
+ </dependency>
+
+ <!-- A dependency on either JUnit or TestNG is required, or the surefire plugin (which runs the tests)
+ will fail, preventing Maven from packaging the WAR. Tapestry includes a large number
+ of testing facilities designed for use with TestNG (http://testng.org/), so it's recommended. -->
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.1</version>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
<build>
<finalName>${artifactId}</finalName>
<plugins>
@@ -31,9 +48,10 @@
<optimize>true</optimize>
</configuration>
</plugin>
+
<!-- Run the application using "mvn jetty:run" -->
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
+ <plugin>
+ <groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
<!-- Log to the console. -->
@@ -44,9 +62,27 @@
</requestLog>
</configuration>
</plugin>
+
+
+ <!-- This changes the WAR file packaging so that what would normally go into WEB-INF/classes
+ is instead packaged as WEB-INF/lib/${artifactId}.jar. This is necessary for Tapestry
+ to be able to search for page and component classes as startup. Only
+ certain application servers require this configuration, please see the documentation
+ at the Tapestry 5 project page (http://tapestry.apache.org/tapestry5/). -->
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <archiveClasses>true</archiveClasses>
+ </configuration>
+ </plugin>
</plugins>
</build>
+
<reporting>
+
+ <!-- Adds a report detailing the components, mixins and base classes defined by this module. -->
<plugins>
<plugin>
<groupId>org.apache.tapestry</groupId>
@@ -54,12 +90,12 @@
<version>${tapestry-release-version}</version>
<configuration>
<rootPackage>${packageName}</rootPackage>
- </configuration>
+ </configuration>
</plugin>
</plugins>
</reporting>
-
-
+
+
<properties>
<tapestry-release-version>5.0.2-SNAPSHOT</tapestry-release-version>
</properties>
Modified: tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/java/pages/Start.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/java/pages/Start.java?view=diff&rev=510105&r1=510104&r2=510105
==============================================================================
--- tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/java/pages/Start.java (original)
+++ tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/java/pages/Start.java Wed Feb 21 09:18:52 2007
@@ -4,7 +4,6 @@
/**
* Start page of application ${artifactId}.
- *
*/
public class Start
{
Modified: tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/java/services/AppModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/java/services/AppModule.java?view=diff&rev=510105&r1=510104&r2=510105
==============================================================================
--- tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/java/services/AppModule.java (original)
+++ tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/java/services/AppModule.java Wed Feb 21 09:18:52 2007
@@ -13,6 +13,10 @@
import org.apache.tapestry.services.RequestHandler;
import org.apache.tapestry.services.Response;
+/**
+ * This module is automatically included as part of the Tapestry IoC Registry, it's a good place to
+ * configure and extend Tapestry, or to place your own services.
+ */
@Id("app")
public class AppModule
{
@@ -20,11 +24,24 @@
public static void contributeApplicationDefaults(
MappedConfiguration<String, String> configuration)
{
+ // Contributions to tapestry.ioc.ApplicationDefaults will override any contributes to
+ // tapestry.io.FactoryDefaults (with the same key). Here we're restricting the supported locales
+ // to just "en" (English). Tapestry will be most efficient with a finite number of supported locales.
+ // As you add localised message catalogs and other assets, you can extend this list of locales (it's
+ // a comma seperated series of locale name; the first locale name is the default when there's no
+ // reasonable match).
+
configuration.add("tapestry.supported-locales", "en");
}
- // This may eventually be baked into tapestry-core:
-
+
+ /**
+ * This is a service definition, the service will be named app.TimingFilter. The interface,
+ * RequestFilter, is used within the tapestry.RequestHandler pipeline. Tapestry IoC is
+ * responsible for passing in an appropriate Log instance. Requests for static resources are
+ * handled at a higher level, so this filter (once contributed into the tapestry.RequestHandler
+ * service) will only be invoked for Tapestry related requests.
+ */
public RequestFilter buildTimingFilter(final Log log)
{
return new RequestFilter()
@@ -48,11 +65,21 @@
};
}
+ /**
+ * This is a contribution to the tapestry.RequestHandler's service configuration. This is how
+ * we extend Tapestry using the timing filter. A common use for this kind of filter is transaction
+ * management or auditting.
+ */
@Contribute("tapestry.RequestHandler")
public void contributeRequestFilters(OrderedConfiguration<RequestFilter> configuration,
@InjectService("TimingFilter")
RequestFilter filter)
{
+ // Each contribution to an ordered configuration has a name, which will be qualified with
+ // the module's id. Here, the fully qualified id will be "app.Timing". When necessary, you may
+ // set constraints to precisely control the invocation order of the contributed filter
+ // within the pipeline.
+
configuration.add("Timing", filter);
}
Modified: tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/resources/log4j.properties?view=diff&rev=510105&r1=510104&r2=510105
==============================================================================
--- tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/resources/log4j.properties (original)
+++ tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/resources/log4j.properties Wed Feb 21 09:18:52 2007
@@ -18,4 +18,4 @@
# Turning on debug mode for a page or component will show all of the code changes that occur when the
# class is loaded. Turning on debug mode for a page will enable verbose output about rendering
# the page (and its components).
-# log4j.category.${packageName}.pages.MyPage=debug
+# log4j.category.${packageName}.pages.Start=debug
Modified: tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/Start.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/Start.html?view=diff&rev=510105&r1=510104&r2=510105
==============================================================================
--- tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/Start.html (original)
+++ tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/Start.html Wed Feb 21 09:18:52 2007
@@ -12,7 +12,7 @@
<p>
- [<a t:type="PageLink" page="Start">refresh</a>]
+ [<a t:type="PageLink" t:page="Start">refresh</a>]
</p>
</body>
</html>
Modified: tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml?view=diff&rev=510105&r1=510104&r2=510105
==============================================================================
--- tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml (original)
+++ tapestry/tapestry5/tapestry-simple/trunk/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/web.xml Wed Feb 21 09:18:52 2007
@@ -5,6 +5,8 @@
<web-app>
<display-name>${artifactId} Tapestry 5 Application</display-name>
<context-param>
+ <!-- The only significant configuration for Tapestry 5, this informs Tapestry
+ of where to look for pages, components and mixins. -->
<param-name>tapestry.app-package</param-name>
<param-value>${packageName}</param-value>
</context-param>