Archive for the 'Tapestry 5' Category

Ganymede, run-jetty-run, and Tapestry 5

Monday, January 19th, 2009

Eclipse Ganymede 3.4.1 is so far a great environment for Tapestry 5, when paired with the m2eclipse plugin and run-jetty-run launcher (gorgeous live class reloading). A couple of quick notes: 1) Jetty’s slf4j breaks Tapestry’s.This is easily correctable by adding the VM argument to the launch configuration:-Dorg.mortbay.jetty.webapp.parentLoaderPriority=true (wiki article). 2) If using run-jetty-run 1.0.1, know that it will not add the servlet api jar to the classpath.The funny thing is that it does include this jar as a dependency, so it ends up in your maven repository (servlet-api-2.5-6.1.9.jar for example). You can easily “Add external jar” to include it, and be on your way.

Tapestry 5: A Minor AJAX Enhancement

Wednesday, March 19th, 2008

Tapestry 5 has seen a lot of updates over the past couple of months. With the addition of the Autocomplete mixin and the Zone component, AJAX is becoming evermore supported and ingrained. When writing AJAX components, using the Autocomplete source as a reference to “how it should be done” is a great thing to do. It’s concise, simple, and shows that AJAX components are on their way to feeling very natural. AJAX event handlers for components behave much the same as they do for normal ones, with the addition of a few new options in the return type. Tapestry makes it easy to respond with JSON objects, in that you can return a JSONObject:


Object onUpdatelist() {
	JSONObject messages = new JSONObject(
		"{users:[{user: 'clewis', firstName: 'Chris'}]}");
	return messages;
}

Nice. However there is another type that would be a very natural return type, JSONArray (not supported as of r638979). I say this because it’s already available in the API, and developers quite often need to return collections of (JSON) objects. So, why not support JSONArray return values? As it turns out, adding this support is not at all difficult, so today I opened a ticket and provided a patch to do just that. Check it out at: https://issues.apache.org/jira/browse/TAPESTRY-2286. The patch updates tapestry’s configuration module, and requires the additional class. With this addition you can now return JSONArrays, without the bother of wrapping your list in a useless object:


Object onUpdatelist() {
	JSONArray messages = new JSONArray("[{user: 'clewis', firstName: 'Chris'}]");
	return messages;
}

Of course even without compiling this into tapestry, you can provide this class and wire it up through your own module.

Involvement

Tuesday, February 19th, 2008

In an attempt to keep a somewhat vibrant blog about my professional (and nerdy personal) life, I’m writing to share my involvement in a small open-source project: tapestry5-components. This is a component library for the much-anticipated Java web framework, Tapestry 5. Today I officially joined the project and merged my code into the svn repo. This code was from a much smaller component library I started called gc-tapestry-components. I will work on this project in free areas of time (as they arise), and even though my contributions may be small at first, I will strive to keep them significant.