This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes Dealing in jsf with multiple domains pointing to the same app/war. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Dealing in jsf with multiple domains pointing to the same app/war." Watch "Dealing in jsf with multiple domains pointing to the same app/war." New topic
Author

Dealing in jsf with multiple domains pointing to the same app/war.

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello,
I would like to set up the following architecture:
-Several domain names i.e. www.mydomain.fr and www.mydomain.com pointing to one web app in tomcat possibly with <alias> config in tomcat.
My question is what is the best way to be aware of whether a request comes from a domain or another from within the jsf code?
I found a way using externalContext.getRequestContextPath() but it means I have to test this at every request or store it in the session which is not very good.
Any better design anyone?
Thanks in advance,
J.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

What's not good about it? You do of course have to test it for every request, there's no getting around that.

If you were thinking you would have to duplicate the testing code into dozens or thousands of components, that's not the case. That sort of thing is what a servlet filter is for. You only need one instance of the testing code.
Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Thanks for your reply and your the tip Paul.
Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Oops. I am now realising I have another question:
How do I set the jsf uiviewroot locale from the servlet filter?
Is that possible at all?
J.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dealing in jsf with multiple domains pointing to the same app/war.