File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes -> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark " ->" Watch " ->" New topic
Author ->

Bill Goldsworthy

Joined: Dec 21, 2004
Posts: 27

What's the best way to 'correct' an client's URL who is accessing my site via just the domain name, no 'www.' prefix?

I would like to correct to the full '' just for consistency.

I had thought a Tomcat configuration might take care of it for me, I'd like it to work for whatever URL came into my site.

Many thanks,

Increasingly, people seem to misinterpret complexity as sophistication, which is baffling - the incomprehensible should cause suspicion rather than admiration. Possibly this trend results from a mistaken belief that using a somewhat mysterious device confers an aura of power on the user. Niklaus Wirth
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Not sure it's the best way but one solution would be a filter with a test that looks something like:

I'm sure there would be some other "gotchas" but that's the basic idea.

Also, if you're fronting Tomcat with Apache you might want to look into mod_rewrite

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bill Goldsworthy

Joined: Dec 21, 2004
Posts: 27
Thanks, I will look into that!
I agree. Here's the link:
subject: ->
jQuery in Action, 3rd edition