This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.
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.
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.