• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1305
  • Last Modified:

Multiple Locales, Multiple Applications, Single JBoss 4.5 instance

Hi,

I am currently developing a set of applications that will all run in a single instance of a JBoss container (version 4.5). The applications have no shared code, but do have different Locales. Here are some (made-up) examples of what the applications / locales could be:

1. mywebsite.com
2. hablainglese.es
3. meingott.de
4. heisannhoppsan.no

None of these applications are internationalized, and it is wort stressing that I am not enquiring about traditional internationalization (one app, many languages, locale determined by web browser OS settings at request time). Rather, this is a question of how to run multiple sites with different server locales on a single JBoss instance.

I have allready had a go at this, but I have not been succesfull in getting it to work. Here is the code that is not working:

In my servlet startup initialization:
    ...          
    Locale.setDefault(Locale.FRENCH);
    ...

My JSP:
<%@ page language="java" pageEncoding="UTF-8" session="true"%>
<%@ page import="java.util.*" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title> Internationalization Test </title>
    </head>
    <body>    
        <h1>Country:  <%=Locale.getDefault().getCountry()%></h1>
        <h1>Language: <%=Locale.getDefault().getLanguage()%></h1>
    </body>
</html>

I think this approach is flawed, as the last servlet to be initialized would set the same default locale for all applications running on the server.

Any ideas?

Henrik

PS! your timezone selector for this form at ('http://www.experts-exchange.com/newQuestionWizard.jsp') is impossible to use. I can't find London / GMT !
0
henrikpettersen
Asked:
henrikpettersen
  • 4
  • 3
1 Solution
 
matthew016Commented:
Get the locale of the request, not of your server
0
 
matthew016Commented:
<%= request.getLocale().getCountry() %>
0
 
henrikpettersenAuthor Commented:
Thank you, Matthew, but this is not quite what I am attempting to achieve: If I get the locale from the request, I will get the location of the end user, i.e. if Windows country/language is set to spain/spanish, the web server will give me a spain/spanish locale (Please feel free to correct me if this assumption is incorrect).

Perhaps I should try to rephrase the question a bit:
How can I harcode the locale for a single application, instead of setting the locale at the server/global level?

Thanks!

H
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
henrikpettersenAuthor Commented:
... By "if Windows country/language is set to spain/spanish", I mean the settings of the underlying ooperating system for the end user browsing the site.
0
 
matthew016Commented:
Sorry I didn't understand the question. Now are you sure this is impacting the other applications ?
Each application has it's own Java Virtual Machine I tought.
0
 
matthew016Commented:
Anyway you could define a new Locale in each application,
and have a method getLocale in some class of the application which will give you the good locale instance.
0
 
henrikpettersenAuthor Commented:
Hm, yes. You're right. I'm overcomplicating things.

Thank you!

H
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now