This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Diffrent Actions from Virtual hosts 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 "Diffrent Actions from Virtual hosts" Watch "Diffrent Actions from Virtual hosts" New topic
Author

Diffrent Actions from Virtual hosts

Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
Hi didn't know where to post this so I hope this is ok!

I have 4 diffrent websites that differs in language and looks. There are the same data, database but different looks. They all have different URLs to but I want them to go to the same context in tomcat.

I found this on how to add virutal hosts to the samt context.
Haven't tried it yet but I hope it works. My problem is that I want to set LanguageId and StoreId when the user access the URL. How can I point the virtual host to different Struts actions? Is there any other way of doing this. Suggestions would be appreciated.


SCJP1.4
Rashid Mayes
Ranch Hand

Joined: Jan 11, 2006
Posts: 160
Assuming the languageid and storeid are dependent on the website, and that you are using non-ip virtual hosts, the host header should be enough to determine which languageid and storeid to use.

I appears that you setting up 4 alias for the same application. The application can examine the host header and present the proper language and store ids.

Off the top of my head:

1) check the host header
2) using the host header value, i.e. xxxx.com, retrieve the corresponding store object
3) Use the store object to determine the language, branding, etc for display

Keep in mind that none of this works if the browser (client) does not send the host header.

We solved a similar problem for our CliqCafe application. In our case, we needed dynamic control over the branding and resources. In simplistic terms, someone can sign on for CliqCafe.com, buy a domain on Goddady, point their A record to our server, enter there domain name into their CliqCafe account, and instantly create a custom branded web site.

For example,

http://evergladesbc.com
http://worlddeveloper.org
http://astrientlaboratories.com

to name a few, are all served by the same host, same web application and context, without requiring any modifications to the server.xml. Our solution is probably a bit more complex than what is required for your situation.

Here are two issues you may encounter.

SSL, your cert may not match your domain. These warnings can be nuisance and users may have questions.

In our case we needed to restrict hosted resources for an account showing up on the site of another account. i.e. Store A's identity materials should be be accessible through Store B's site. Although solvable, its comes at a cost in complexity and overhead.


Rashid Mayes
http://www.hostj2me.com/ - http://www.worlddeveloper.org/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Diffrent Actions from Virtual hosts
 
Similar Threads
How to install same application in multiple servers in websphere netdeployment App Server Environmen
How does Mod_JK connector work?
all hosts are sharing the same context ?!!
Virtual Hosting with Tomcat
Multiple WAS nodes on a single machine managed through one deployment manager