tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Locale difference with Console and Windows Service
Date Sat, 04 Nov 2006 18:54:45 GMT
-----BEGIN PGP SIGNED MESSAGE-----
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 startup.sh 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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFTOH19CaO5/Lv0PARAv/ZAJwKJC4VFWUCu9ZT+Nbh5/WYxnvAWgCgjKoF
RN4YoFvfGt/sRS7Z/uCKpk0=
=krgB
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message