Meaningless Drivel is fun!*
The moose likes Tomcat and the fly likes domain.com -> www.domain.com Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "domain.com -> www.domain.com" Watch "domain.com -> www.domain.com" New topic
Author

domain.com -> www.domain.com

Bill Goldsworthy
Greenhorn

Joined: Dec 21, 2004
Posts: 27
Hello,

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 'www.domain.com' 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,
Bill


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
Sheriff

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
Greenhorn

Joined: Dec 21, 2004
Posts: 27
Thanks, I will look into that!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: domain.com -> www.domain.com
 
Similar Threads
Practical WebObjects Questions
any experience out there with mod_proxy_html or other uri modification methods?
why i can not see any of servlet request parameters ?
how to make html files within a folder accessible only through jsp
url formating in web apps