Tapestry-4.1.6 maven archetype

There’s an updated archetype for Tapestry-4.1.6-SNAPSHOT over at (the well known snapshot repo)
http://people.apache.org/repo/m2-snapshot-repository

All the hard work was done by Ulrich Stärk, so big thanks to him

For the record, here’s how to quickly generate a Tapestry project

mvn archetype:create -DarchetypeGroupId=org.apache.tapestry \
 -DarchetypeArtifactId=tapestry-archetype \
 -DarchetypeVersion=4.1.6-SNAPSHOT -DgroupId=org.example -DartifactId=myapp \
 -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository

Tapestry for Nonbelievers

InfoQ has just released an article on Tapestry 5.

It’s a well written article that manages to cover many of the new features introduced in Tapestry. It goes through:

  • Setting up a Tapestry application
  • Creating a page and a component
  • Using the awesome Grid component for easy display of your data
  • Using BeanEditForm for one-line pojo editing!!!
  • Ajax and ajax components

So, go ahead and read it.

And now, moving on to the exclusive content of this entry…During my last trip to Germany (Emi and I were supposed to fly for Dubai, but we ended up in Frankfurt – that is another story) i got to meet the two authors of this article, Renat Zubairov and Igor Drobiazko.

So, here’s a photo of the three of us drinking beer:

Patching maven-surefire-plugin… yet again!

Patching maven-surefire-plugin… yet again!

People have been using the 2.4-collab-SNAPSHOT of maven-surefire-plugin for a long time. The main reason for that was that the ‘official’ 2.4-SNAPSHOT was … incompatible with the latest TestNG versions.
Thankfully, 2.4, 2.4.1 and 2.4.2 official versions have been recently released (Jan-Feb 2008) and TestNG support is back to normal. OR is it?
Well, according to SUREFIRE-463 (disclaimer: i filed and provided the patch for that) you’re NOT able to run custom TestNG suite XML files, i.e. use the suiteXmlFiles configuration of the plugin, as described here.
So, if you too are bitten by that issue, go ahead and vote for it.

Tapestry 5 book

Tapestry 5 book

Yeap, written by Alexander Kolesnikov, it’s been out for a while now: Tapestry 5: Building Web Applications

Here are some first comments from the mailing list:

Andy Huhn

I guess I’ll be the first to mention…my copy of the book arrived last
week! (Thursday) I’ve already read a good chunk of it, and skimmed
what I didn’t read. Excellent!

Even though I’ve been plowing my way through learning Tapestry for the
past few months, I found the book to be an excellent, rigorous treatment
of a lot of the details that I haven’t been able to find put together
all in one place so far. It’s definitely written to be simple enough
for someone who doesn’t know Tapestry at all to get started, but even
though I’m familiar with all of the basics, I still found it wonderfully
enlightening to read through it. It’s helping me pull together some of
the basics that I haven’t been able to get a handle on yet.

Alexander…excellent job!

Mahen Parera

I also received my book last week, and liked it very much. I was looking
for more sort of internals about the T5 framework tho.
Anyway, the book is great, i learned some stuff that i didnt know about.
Hopefully there will be some books coming along in the future which
explain more details about components and how the framework really
works,, more in to the internals of the framework.

Mark Shead

I will second this opinion. The book is great! I’m working through
all the examples and it is by far the fastest way (I’ve found) to get
up to speed on T5. Alexander did an excellent job of keeping things
simple enough to work through, while hi-lighting the different ways of
accomplishing the same thing.

Peter Stavrinides

Also received mine yesterday, a job well done Alexander! … it’s
simple, concise and to the point… no blabber, but as you said its a
quickstart, not so much for experienced Tapestry users.

A small tacos update

No announcements yet, just this:

 [INFO] Tacos ................................................. SUCCESS [20.973s]
 [INFO] Tacos Site Skin ....................................... SUCCESS [1:39.694s]
 [INFO] Tacos Core ............................................ SUCCESS [1:16.806s]
 [INFO] Tacos Annotations ..................................... SUCCESS [9.568s]
 [INFO] Tacos Cometd .......................................... SUCCESS [8.425s]
 [INFO] Tacos Demo ............................................ SUCCESS [25.451s]
 [INFO] BeanForm .............................................. SUCCESS [0.169s]
 [INFO] BeanForm Core ......................................... SUCCESS [25.614s]
 [INFO] BeanForm Examples ..................................... SUCCESS [17.668s]
 [INFO] Tacos Dojo ............................................ SUCCESS [2.079s]
 [INFO] Tacos jQuery .......................................... SUCCESS [2.934s]
 [INFO] Tacos-Seam ............................................ SUCCESS [0.116s]
 [INFO] Tacos-Seam Core ....................................... SUCCESS [44.754s]
 [INFO] Tacos-Seam Demo ....................................... SUCCESS [8.213s]

POSTing with commons-httpclient

POSTing with commons-httpclient

So, commons-httpclient is quite useful and easy for programming http operations, e.t.c. As their tutorial explains, you just create an HttpClient, then a PostMethod or a GetMethod and finally you have the client execute the method.
In the particular use case i was working on, i needed to post some data to a MS ASP 6.0 Greek Server – both the request and the response should be in windows-1253. After testing a simple get request and seeing it working, I thought it wouldn’t get any easier than that… and it didn’t!
When doing post (which is a requirement due to the size of the data), i kept getting all those weird chars, e.t.c. I tried
setRequestHeader("Content-Type", "charset=windows-1253");

but somehow, the server wouldn’t get my data this time.

So, anyway, to cut a long story sort (and probably save you the hours I lost), the key is to remember you’re doing a post (!), and do

 setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=windows-1253");
 

BTW, addRequestHeader("Content-Type", "charset=windows-1253"); wouldn’t work either.

More Tapestry sites

Here’s 3 more public Tapestry sites (using Dojo for ajax + javascript):

  • http://www.sourcekibitzer.org/ is … sourcekibitzer! It provides detailed programming metrics into the relevant code quality, member activity, individual developer know-how, and scope of open source projects. It’s using Tapestry 4.0.2 and Tacos and it has recently been open-sourced. You can have it running locally in 5 mins!
  • http://freebookie.org is a free internet bookmaker that uses the js effects and ajax that Tapestry 4.1.2 provides (via Dojo 0.4.3). The complete project is open-source, available from http://code.google.com/p/bookie and quite easy to setup and play with locally.
  • http://news247.gr is a high volume greek news site that’s constantly updated. It’s on Tapestry 4.1.3 and does persistence with iBatis

So, if you’re interesting in having a look at Tapestry, why not grab the source of freebookie or sourcekibitzer and hack’em around?

Cleaning a maven repo

Cleaning a maven repo

Just saw the size of my local maven repo… and it isn’t nice

So, I’m wondering, is there a maven goal that cleans up ‘obsolete’ files? I want files like old snapshot jars deleted … cause, if you depend on SNAPSHOT versions of projects that update often, you do end up with LOTS of them!

Using Groovy for Tacos-Demo & Tapestry

So, since groovy compiles down to bytecode, it can be used anywhere… That’s how i did a test tapestry page a month ago.

But this time i took some time off to play with groovy and the tacos demo app (Shing is hosting it for us right now) and the JetGroovy plugin of IntelliJ Idea 7.0M2. My findings are really nothing new and mostly deal with java vs. groovy … things!

So, the ajax tree demo uses a TreeData bean for its data… here it is in java:

 public class TreeData {
  private String name;
     private List<TreeData> children;
 
     public TreeData() {this(null);}
 
     public TreeData(String name) {
         this.name = name;
         children = new ArrayList<TreeData> ();
     }
 
     public String getName() { return name; }
 
     public void setName(String name) { this.name = name; }
 
     public List getChildren() { return children; }
 
     public void setChildren(List<TreeData> children) { this.children = children; }
 
     public void addChild(TreeData value) {
         String name = value.getName();
         for (int i = 0; i < children.size(); i++) {
             TreeData treeData = children.get(i);
             if (name.compareTo(treeData.getName()) < 0) {
                 children.add(i, value);
                 return;
             }
         }
         children.add(value);
     }
 
     public TreeData getOrCreateChild(String value) {
         for (TreeData treeData : children) {
             if (treeData.getName().equals(value))
                 return treeData;
         }
         TreeData data = new TreeData(value);
         addChild(data);
         return data;
     }
 }

and here it is in groovy:

 class TreeDataGroovy {
     String name
     List<TreeDataGroovy> children
 
     def addChild(TreeDataGroovy value) {
         if (children==null) children = [];
         int pos = children.findIndexOf { value.name < it.name }
         children.add(pos, value)
     }
 
     TreeDataGroovy getOrCreateChild(String value) {
         TreeDataGroovy data = children.find {it.name==value};
         if (data==null) {
             data = new TreeDataGroovy(name:value)
             addChild(data)
         }
         return data;
     }
 }

On the other hand, I ended up dealing with exceptions and errors quite more often that i do in java (perhaps due to my lack of knowledge for groovy) so it did force me in more unit tests, which some say is a good thing and others the opposite.

Tacos 4.1.0 released

Here’s the announcement:

Hi all,
It’s a pleasure for me to announce the release of Tacos 4.1.0
(http://tacos.sourceforge.net/tacos4.1/) – the first stable tacos
release supporting Tapestry 4.1.x and offering:
  • Dojo Widget – Generic component for (almost) all dojo widgets.

  • script.aculo.us – brand new components based on script.aculo.us

  • Comet component

  • New Annotations – allow you to inject ILinks and easily check if
    component parameters are bound.

  • New binding prefixes – including ‘template’ that makes string
    related ognl expressions easier, and ‘absoluteAsset’ which works like
    the asset binding but makes sure that the created url is absolute.

  • BeanForm – All-in-one, flexible bean editor BeanForm has become a
    major part of Tacos. This update offers complete compatibility with
    Tapestry 4.1.2.

  • Tapdoc – though not yet properly released from within tacos, it
    offers a maven plugin for component reference generation.

Furthermore:

  • The jars have already been deployed over at ibiblio.org – more
    installation instructions can be found at
    http://tacos.sourceforge.net/tacos4.1/tacos-core/quick-start/downloading.html

  • Beanform (http://beanform.sourceforge.net/) and Tapdoc
    (http://www.erinors.com/developer/project/tapdoc/) have merged
    with Tacos.

  • Huge thanks to our latest committer Igor Drobiazko whose excitement
    has shed new life to the project.

  • Extra special thanks to all the people that contributed code, esp.
    Daniel Gredler, Norbert Sandor, Patrick Moore, Ming Jiang and Craig Spry

Have fun with it!