Upgrading Equinox to Tapestry 4.0
Last week, I upgraded Equinox from Tapestry 3.0.3 to Tapestry 4.0. The commit log can be found on Fisheye. Here are some details that might help you upgrade.
- Tapestry 4.0 doesn't support Spring out of the box. This was surprising to me b/c one of the advertised features of Tapestry 4.0 (or Hivemind actually) was native Spring support. Luckily, Howard released the tapestry-spring project which solves this problem. Dropping the JAR in your classpath is enough to get built-in integration. It'd be nice to see this library become part of tapestry (possibly in the tapestry-contrib.jar).
- Tapestry-Flash makes it easy to do success messages when redirecting. Furthermore, it's nice to see how to do redirecting w/o throwing a PageRedirectException.
- PageRenderListener has changed to PageBeginRenderListener.
- When using <inject> for a property, I had to remove any
public abstract void setXXX
methods as I got an error otherwise. Luckily, the error message told me exactly what to do. - Injecting dependencies during testing is fairly simple using the Creator class. Equinox's UserFormTest.java has a good example of this. I did have to create a MockRequestCycle and a MockPageService, but both were pretty easy to write.
- Friendly URLs are much easier to implement in Tapestry 4.0. However, Tapestry still doesn't allow you to use the same extension for everything - so I ended up with .html, .direct, .sdirect and .svc extensions. I'd prefer a single extension, but oh well.
- You'll need to change all your *.page files to use the new 4.0 DTD. I don't think this is absolutely necessary, but it does simplify things.
- As part of the 4.0 DTD, <property-specification> has changed to <property> and the "type" attribute is not allowed (b/c it's inferred using reflection I assume). In addition, <binding name="foo" expression="bar"> has changed to <binding name="foo" value="bar"> and <context-asset> has changed to <asset>. Also, <message-binding> has been removed in favor of <binding>. The userForm.page diff shows detailed changes.
- @Conditional has changed to @If.
- The issue where Tapestry sets the focus on the first required field still occurs. An easy workaround is to make the first field required.
- The @DatePicker component has changed from using the "format" attribute to using the "translator" attribute for formatting dates. The popup calendar also seems to have changed - I had to add new CSS rule to colorize the header properly.
Hopefully this simplifies your Tapestry 4.0 upgrade.
Posted by Square Root on March 08, 2006 at 07:41 PM MST #
Posted by kerister on December 15, 2009 at 02:42 AM MST #