This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of DevSecOps Adventures: A Game-Changing Approach with Chocolate, LEGO, and Coaching Games and have Dana Pylayeva on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

JForum nice urls (as on Java Ranch)

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author & internet detective
Posts: 41988
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Lyndon Smith
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
author & internet detective
Posts: 41988
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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


Correct
 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Friendly URLs can be configured in Web Server. I just heard it. I have no more information. Sorry.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic