Our forums are running on a heavily modified version of JForum 2. The pretty URLs are just one of the many features that were added in-house.
At this point we don't think the JForum team is interested in our changes, because they've moved on to JForum 3 with a rather different architecture, and we have not yet decided whether to share our version as a fork. If we choose to do so, we'll announce it here.
Lyndon Smith wrote:How is this done, I don't think it is a standard JForum feature.
Any ideas/advice would be appreciated.
I wrote a filter that delegates to a bunch of classes that do convert to/from the URLs. The idea was to not have to change the JForum core code - it still deals with the original URLs. It's 9 classes of "real" code and just under 100 unit tests. The point being that it's nuisance code to write. It's also very JavaRanch specific, so sharing the code won't help you much. It also depends on some other changes we made to JForum (and no, I don't know which ones), so you couldn't use it anyway.
On a high level, the filter calls an implementation of HtmlParser's (open source library) NodeVisitor. For the URLs that we want to change, it delegates to a UrlPatterns classes that converts into/from the desired format. The catch is that you can't change all URLs because you need to leave user posts, ads, etc alone.
HUGE CAVEAT: If I was implementing this feature again, I would not do it this way. It isn't the easiest code to maintain and has a lurking issue that when you add certain features, you need to remember to add the reg exps. The only reason I did it this way was because we thought we might want to upgrade JForum 2.X since it was such a long term project. Turns out we changed too much to do that easily anyway and JForum 3 is completely different. Our fork is now our own and only based on JForum. If I was doing this again, I'd change the URLs in the source code - at least on the outgoing side. Doing the regexp transformation on the incoming side is *much* easier.