tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maxt <>
Subject Re: Locale difference with Console and Windows Service
Date Mon, 06 Nov 2006 22:50:15 GMT

To give a little more background, I have a Servlet, Tomcat application that a
potential customer can download and install on their Windows PC. I would
like to create localizations for it.

It is easier to enable such a person to use Windows Services to start Tomcat
without having any knowledge of Tomcat.

I have been testing this on my own Australian computer by changing the
Region to en_US.

The Robot enables the potential customer to follow a set of AccessKey based
HTML pages to do an initial setup of their own situation.

These two functions do not seem to work correctly on my Australian computer
when Region is en_US with Tomcat Services, but are OK when using the


Christopher Schultz-2 wrote:
> Hash: SHA1
> Max,
> maxt wrote:
>>> Is the locale of your /user/ set to en_US, or is the whole OS set to
>>> that?
>> The Windows OS is therefore set to US. When I refer to a user, I am not
>> referring to a Unix type user but a customer who may be in any Region or
>> Locale.
> Sorry, my mistake.
>>> Since windows services run as another user (I'm sure you can pick), you
>>> need to make sure that the locale of /that/ user is set appropriately.
>>> Is it possible that the user that services "run as" is not configured
>>> for en_US?
>> Why does a Service pick up another Locale to the use of a Console?
> Well, when you run from the command-line, Java picks /your/
> locale as the default (en_US). When the service runs, it picks the
> locale based upon the user used to run the service (which I assume is
> still set to en_AU). If that's not the case, then I don't understand it.
>> Everything else is the same. Run as Console is OK, then run as a Servie
>> and it is picking up the original Region set on Java installation (that
>> has since been changed for testing) perhaps??
> IIRC, Java installations themselves do not have a locale. It all depends
> on the user who actually started the VM.
>>> In our apps, we sniff the locale of the user from the request and stick
>>> it in the session (actually, Struts does that for us). You can then use
>>> that locale for resource bundles, time and date formatting, etc. Any
>>> reason to worry about the "default" locale in your case?
>> The resource bundles work OK for Console, but not for Service.
> How do you determine the locale of the remote (web) user? Are you
> storing that locale information anywhere?
>>>>> The same problem applies to the use of the Robot class used for
>>>>> sending
>>>>> keystrokes. OK with Console, no response or error with Services. 
>>> Well, that's a different problem. Do services have a console to run in?
>>> I would imagine that the service gets run in a manner quite like a UNIX
>>> app with no X availability. If that's true, then there's nothing to
>>> which you can send keystrokes.
>> The keystrokes are being sent to HTML fields in a JSP page.
> You have a servlet that sends keystrokes to an HTML field in a JSP page?
> I think I'm totally confused at this point. Aren't you /generating/ that
> page to display on the remote client? If so, why do you need to send
> keystrokes to anything? Or, is this some unit-testing rig that you are
> talking about?
>> I am not using Struts.
> I only mentioned struts because it does some of our dirty work for us.
> It doesn't matter if you do or do not use struts; the fact remains that
> you need to detect your /remote/ client's locale.
> It sounds like you are changing your own user's locale (from en_AU to
> en_US) and then attempting to access your webapp through a browser. That
> should all work completely, regardless of how you start Tomcat (the
> remote client should always send their preferred locale in HTTP
> headers). I suspect that you are incorrectly determining the locale of
> the remote user, and instead getting the locale of the local (on the
> server) user.
> - -chris
> Version: GnuPG v1.4.5 (MingW32)
> Comment: Using GnuPG with Mozilla -
> RN4YoFvfGt/sRS7Z/uCKpk0=
> =krgB
> ---------------------------------------------------------------------
> To start a new topic, e-mail:
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View this message in context:
Sent from the Tomcat - User mailing list archive at

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message