szquadri / javamelody

Automatically exported from code.google.com/p/javamelody
0 stars 0 forks source link

use custom user locale for reports #405

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Javamelody uses request.getLocale() for i18n - so i18n depends on browser 
settings.
I have an application with a custom user-administration.
Is there a way of setting the locale to be used per request e.g. based on the 
current (db-)user's locale.
I just found a way of specifying a global locale.

Original issue reported on code.google.com by gerp...@gmail.com on 29 Apr 2014 at 10:41

GoogleCodeExporter commented 9 years ago
Indeed, default locale for reports are based on browser settings.
And you can override browser settings with a global locale using a parameter: 
-Djavamelody.locale=en_US for example.

But there is no included way to use a custom user locale from a database.

Still, you could write a servlet filter to override the request locale, and add 
a mapping in your web.xml to the url-pattern "/monitoring", before javamelody 
MonitoringFilter.

The nearest servlet filter that I have found overriding request.getLocale() is 
the following:
http://www.ibm.com/developerworks/websphere/library/techarticles/0606_ambati/060
6_ambati.html
(remove the implements "...ibm" and the clone() method which are useless)

This issue is won't fix here. Can we close it?

Original comment by evernat@free.fr on 29 Apr 2014 at 11:32

GoogleCodeExporter commented 9 years ago
hi,
in fact I already did something like this. but I didn't extend 
servletrequestwrapper and because of that, it failed in WebLogic.

This issue may be closed.
regards

Original comment by gerp...@gmail.com on 29 Apr 2014 at 1:32

GoogleCodeExporter commented 9 years ago
ok, thanks

Original comment by evernat@free.fr on 29 Apr 2014 at 2:16