What's new in SiteMesh 3?
Introduction (TODO)
This tutorial is a quick introduction to using SiteMesh3 in a web-application. It covers:
- A high level overview of how SiteMesh3 works
- Installation and configuration
- Building and applying a simple decorator
It is recommend you read the high level SiteMesh Overview before this tutorial.
SiteMesh 3 has been completely rebuilt from the ground up. It's more efficient, easier to use and extensible. While the code is new, it still holds the same values of SiteMesh 2, namely simplicity, robustness and performance.
New Content Processor Architecture
The internals of how SiteMesh processes content have been radically changed. The result is typically a 3X gain in throughput and half the memory usage (based on some typical sized samples).
The new architecture also opens up new possibilities for upcoming features...
Decorator Chaining
Decorators can now be chained together in a website. That is, content can be decorated, then decorated again (and again). The new architecture of the content processor means there is little overhead in applying multiple decorators.
No Tie-ins to Templating Systems
No longer do you need to commit to JSP or Velocity to build your decorators. Like content, decorators can be generated by any technology - even static .html files.
Simplified Configuration
Want to configure purely through Java code, through XML, through Spring, or maybe by convention? It's your choice. And it's easy to plug in your own configuration mechanism.
Offline Site Generation
SiteMesh comes with tools to allow you decorators to content for static websites as an offline task. This can be invoked from a command line tool, an Ant task or through a Java API.
Can be used to cut the cost of hosting (no Java runtime needed on servers) or simplify distribution (e.g. include web-site as part of a downloaded package).
Code Modernization
Under the hood, over 10 years worth of cruft has been cleaned up. This means a simpler API. And many long-standing design decisions have been revisited, which has made the things above possible, and opens the possibility of your own extensions.
The various extension APIs have been revisited to make the easier to understand, with useful hooks and clear documentation.
Reusable Core Building Blocks
Many of the underlying building blocks of SiteMesh are useful to other applications. These have been decoupled from the code, allowing you to reuse them in your own application, even if you don't intend to use SiteMesh.
- The ContentBufferingFilter is a reusable Servlet Filter that intercepts responses and allows modifications to be made to the content.
- The HTML TagProcessor is a high-performant and extensible tag parser that allows for extraction and transformations of content.
Relicensed under the Apache Software License v2.0
This license is used much more widely and approved by many organizations.