Tapestry 5's internal behavior is composed by different things. Some behaviors are carried out by core API interfaces with internal implementations (which you can modify), while others are dictated by configurations. For a complete list of the available configurations, visit this page: http://tapestry.apache.org/tapestry5/tapestry-core/guide/conf.html.

This article aims to highlight a few settings that I have found extremely useful for my development environment.

tapestry.production-mode

This configuration provides Tapestry with the notion of a production vs a development environment. The default value is true, which means that when your application throws an exception the rendered exception report page will be extremely short (and basically useless). This is good in production because you don't want to expose users to confusing internal details, or sensitive data potentially useful by malicious users. However during development you need details, so you will want to set this to false.

tapestry.compress-whitespace

This provides the developer with control over whether or not Tapestry preserves whitespace in the rendered pages. The default value is true, which means that when you view the source of a page you will see something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><title>My Page</title></head><body><div>Welcome to my page!</div></body></html>

when you would normally expect something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <title>My Page</title>
  </head>
  <body>
    <div>
      Welcome to my page!
    </div>
  </body>
</html>

This isn't such a big deal for smaller pages, but for larger ones the output is simply unreadable. Yes, there is always FireBug and it is a brilliant tool, but there are times when I just don't want to use it. To change this you must set the value to false.

tapestry.modules

This one is a must-have for those working on multi-module projects, where one module contains the web application and the others contain contributions to it via additional IoC modules. It is not documented where the other configurations are, and is instead mentioned here: http://tapestry.apache.org/tapestry5/tapestry-ioc/run.html.

It's important to note that you must provide the fully qualified class names of the module classes you with to add, not the simple name. Therefore the module class you want to add is org.myorg.AdditionalModule, you must provide that and not just AdditionalModule.

Many thanks to Massimo Lusetti for pointing this one out!

Summary

Configuration Key

Type

Default Value

Example Command Line Setting

tapestry.production-mode

boolean

true

-Dtapestry.production-mode=false

tapestry.compress-whitespace

boolean

true

-Dtapestry.compress-whitespace=false

tapestry.modules

 

 

-Dtapestry.modules=org.myorg.AdditionalModule,org.myorg.AnotherModule

  • No labels