File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ranch Office and the fly likes JForum nice urls (as on Java Ranch) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Ranch Office
Bookmark "JForum nice urls (as on Java Ranch)" Watch "JForum nice urls (as on Java Ranch)" New topic
Author

JForum nice urls (as on Java Ranch)

Lyndon Smith
Greenhorn

Joined: Sep 26, 2009
Posts: 3
Hi

I see that Java Ranch is using JForum...

I want to use JForum for my sites too.

I see that Java Ranch has nice SEO friendly urls. My question is:

How is this done, I don't think it is a standard JForum feature.

Any ideas/advice would be appreciated.

BTW, I have made JForum work with Firebird 2 database so if any one is interested I can help there.

Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Hi Lyndon,

Welcome to JavaRanch!

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.


[Jess in Action][AskingGoodQuestions]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30116
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Wow. I was not aware that there were many modifications. Hats off.

If I was implementing this feature again, I would not do it this way


I find myself saying that everytime (well almost) I finish writing code. Hind sight indeed has 20/20 vision


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Lyndon Smith
Greenhorn

Joined: Sep 26, 2009
Posts: 3
Thanks for the help guys.

It sort of looks like Jforum 2.1.8 is a final version for JForum 2 does it not?

Maybe I should just add a url column to each table I want to have SEO friendly urls...

I did this on my ebook site that I am writing. I originally wrote the ecommerce software in 2002, it uses Struts 1.

I hold the url on the database and it works a treat. Take a look at http://www.ebookshot.com (it's NOT live yet).

Or maybe I'll just live with the standard urls, they're not so bad...
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30116
    
150

Lyndon Smith wrote:It sort of looks like Jforum 2.1.8 is a final version for JForum 2 does it not?

Correct
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Friendly URLs can be configured in Web Server. I just heard it. I have no more information. Sorry.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41106
    
  45
Friendly URLs can be configured in Web Server.

JForum creates its own URLs - neither any web server nor the servlet container can do anything about them.


Ping & DNS - my free Android networking tools app
 
Don't get me started about those stupid light bulbs.
 
subject: JForum nice urls (as on Java Ranch)
 
Similar Threads
JForum with Oracle 10i and WebSphere
Installing Jforum
jforum
possible jforum future features
Using JForum as a Backend service