-
Jul 4th, 2011, 02:48 AM
#1
Getting locale in MessageSource that extend ApplicationContextAware.
Hi All,
I have a class that implements applicationcontextaware that used to override the messageResource.getMessage feature. However now i have problem on getting the locale from the http://localhost:8080/test?lang=en. I have tried the LocaleContextHolder but it seems like getting the language from the browser itself rather than the param. And also i can't use RequestContextUtils.getLocale(request) as it need request which i dun not have. Any suggestion to deal with this ?
Thanks in advance.
Regards,
Cyril
-
Jul 4th, 2011, 10:40 PM
#2
Hi All,
I still fail to get the locale from the request parameter : http://localhost:8080/test?lang=en.
I tried with the RequestContextUtils.getLocale(request) but still getting the locale from browser setting as below :
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRe quest();
Locale locale2 = RequestContextUtils.getLocale(request);
My purpose is to able to load the correct i18n .properties file as i have implements my own MessageResource to resolve messages. Any help ?
Regards,
Cyril
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules