Saturday, December 02, 2006

More Wicket Stupidity

It seems to be the weekend for stupidity out of Wicket.

God only knows how they managed to introduce this bug: component.setModelObject(foo) will truncate everything after the first semicolon. Yes, that's right: the first semicolon. Why? Your guess is as good as mine. Fortunately, component.getModel().setObject(component, foo) doesn't arbitrarily dislike semicolons and works fine.

More stupidity: ExternalLink is not a Link, though PageLink, BookmarkablePageLink, ResourceLink and so-on are all Links (that is, they extend Link). To Wicket's credit, ExternalLink at least appears in wicket.markup.html.link, although PagingNavigationIncrementLink and PagingNavigationLink, which do extend Link do not. I'm sensing some problems with the project's layout.

Another particular nuisance: there is no nice way of linking from one application to another. This may be because of limitations imposed by the Servlet spec, but it is annoying no less. This manifests itself if you want to move from one application that doesn't do anything special with Sessions to one that does. For example, I have an application for reading articles that doesn't need a session at all (but it implicitly gets a WebSession) with a link to another application for doing an article update. The latter uses an ArticleSession, but the moment you click the link to the homepage of the article update application, you get a class cast exception because the type of WebSession is different from one application to the other.

The solution is to loosely couple the two pages by directing the update link to the other application by its servlet path (e.g., /app/updateArticle) via an ExternalLink (which isn't a Link), but where does that path come from then? I had to settle for getting it out of a properties file for now, until some better way comes along.

I think Wicket could possibly figure this out in the Wicket Servlet by tracking which applications are mapped to which context paths, though this would probably require an additional init-param in the servlet config (since you don't get to know the context path in a servlet's init, though it's coming in the Servlet 2.5 spec... some day). In the near term there doesn't seem to be any other way than the ugly way.

Labels:


Comments: Post a Comment





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]