Pretty URL in Spring

Spring Framework's support for pretty (aka meaningful, restful) URLs was rather weak so I've been hacking together a HandlerMapping implementation and I thought others might find its design useful.

RestfulServletHandlerMapping class currently routes URLs to Controller implementations by configuring properties like this:

<property name="urlParameterPattern" value="\{([\w-_\.]+)\}" />

<property name="urlParameters">


    <entry key="" value="[a-zA-Z][\w-]*" />

    <entry key="post.year" value="20\d\d" />

    <entry key="post.month" value="[01]\d" />

    <entry key="" value="[\w-]+" />



<property name="urlMappings">




       value="blogController" />



Some explanation of the properties:

urlParameterPattern – regular expression used to identify named parameters in urlMappings URL patterns.

urlParameters – collection of named parameters and format specified using regular expression.

urlMappings – collection of URL patterns expressed as regular expressions with named parameters.

Currently, RestfulServletHandlerMapping builds a composite regular expression pattern for each urlMappings entry by replacing named parameters with the parameter's format regular expression. When a request comes in, request URL is compared against each pattern until a match is found. When a match is found, parameter values are stored as request parameters using the parameter name then control is passed to the controller mapped to the URL pattern.

While this design is pretty flexible, it has two shortcomings:

  1. non-ASCII parameters is, while possible, tedious to define.
  2. semantic parameter validation support (is 'donpark' a real user?)

Above shortcomings can be easily avoided by carefully arranging URLs and order of evaluation though.

Pat Buchanan’s White Country

What I would like is — I’d like the country I grew up in. It was a good country. I lived in Washington, D.C., 400,000 black folks, 400,000 white folks, in a country 89 or 90 percent white. I like that country.Pat Buchanan


p dir=”ltr”>What's he going to do when birthrate of non-white Americans threatens his precious idea of America? Demand a national vote to decide birthrate quotas based on race? What the hell is he smoking?

Well, I kinda like the idea of Asshole-Free America. I like that country.

Forecast: Phishing for Ransom

I am expecting early adopter segment of phishers to soon seek easier angle of attack because a) increasing use and rapid advancement of anti-phishing technologies makes phishing harder, and b) each wave of phishing attacks educates their preys.

I think Ransom Phishing is one such angle. Instead of phishing for authentication devices (username/password), ransom phishing's goal is to rapidly increase customer support cost, using existing phishing tools to alarm customers and directing them like one would drive a massive herd of bulls, to a point where it makes more economic sense to pay off the phishers.

Hachiko the Faithful

It's amazing how little stories like that of Hachiko moves you(found via Dave, Bernardo, then google). All it took was the first four paragraphs to bring tears to my eyes. When my wife returned from her workout, we talked about Hachiko and Kamji, my old dog. We both agreed that Kamji would have just stayed home and pooped all over the house to punish me if I didn't return. LOL.

Wikipedia has more details on Hachiko but was not moving at all, probably because the focus on presenting facts. I wonder if there is a wiki for stories, to archive them as well as share them, across cultures and languages.

Thanks to Sploggers

I would like to thank the sploggers for making bloggers' life miserable. Lord knows they worked hard because, these days, most of the comments and trackbacks lead back to splogs. Fantastic! I don't want to sound ungrateful but I must ask them to work harder still because their job is not quite done yet.

What am I saying? I am saying that, if the bad guys do their part, we'll finally have real needs for street-level identities.

Cage as protection, if you have the key that is…

Abe Shinzo Forebodings

I have dark forebodings about Abe Shinzo who will very likely be the next PM of Japan on Sept. 20, thanks to Koizumi's support. Shinzo is a neo-nationalist who seek to rewrite history as well as the Constitution of Japan, erasing shameful past and removing barriers to imperial ambitions.

What will the man behind most of the recent conflicts between Japan and its neighbors do when he becomes shogun? I am expecting conflicts of ambitions and emotions, peace and violence, capitalism and nationalism.

In short, expect far east to compete with middle east for frontpage news while Shinzo is in power.


Some background on Shinzo:

Meiji Restoration was lead by samurais from Choshu (Yamaguchi prefacture) and Satsuma. After they wrestled power from shogun, they put their expansionist ideals into full throttle. The emperor was just a figurehead used to ruled the country. Events unfolded from there that lead to the Second World War.

Shinzo and his father shares the word 'shin' in their names, apparently to pay respect to Takasugi Shinsaku, a hero of the Meiji Restoration. Takasugi Shinsaku's teacher is Yoshida Shoin whom Shinzo admires enough to quote often. Yoshida Shoin was a key expansionist whose ideals such as 'management' of Korea and Manchu and 'control' of China gave birth to expansion efforts spanning Meiji period and beyond.

Choshu contains Shinzo's political district 'given' to him by his father. Nobusuke Kishi, his grandfather from the mother-side, is also from Choshu. Kishi was PM from 1958-60 despite having been imprisoned as a Class A war criminal.

Is Shinzo a free spirit moderate or a closet expansionist? Whether your answer differs from mine or not, I think I have some justifications for having bad forebodings. If he is independent of his background, he shouldn't have built his house on it. He should have refused his father's district but he did and, IMHO, you can't just reap benefits from political background without being influenced.