• 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
  • salvin francis
  • Piet Souris

Diffrent Actions from Virtual hosts

Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,


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.
Crusading Chameleon likes the size of this ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!