Results 1 to 3 of 3

Thread: Locale Incorrectly Set in Request

  1. #1
    Join Date
    Jul 2005
    Posts
    17

    Default Locale Incorrectly Set in Request

    Hi,

    I noticed that trying to fetch the locale in a tag lib using the following doesn't seem to work correctly:

    Code:
    Locale locale = pageContext.getRequest().getLocale();
    Any ideas why this doesn't work?

    Thanks

    jv

  2. #2
    Join Date
    Aug 2004
    Location
    Amsterdam, Netherlands
    Posts
    450

    Default

    The request.getLocale() method returns the locale from the Accept-Header the client sent along with the request and does not always correspond with the locale set by the LocaleResolver. If you set the AcceptHeaderLocaleResolver it will be the same, if you use another LocaleResolver it can be different because for example a CookieLocaleResolver uses a cookie to retrieve the local from, not the AcceptHeader.

    Hope this helps.

    rgds,
    Alef Arendsen
    Alef Arendsen
    SpringSource
    http://www.springsource.com

  3. #3
    Join Date
    Sep 2005
    Posts
    8

    Default

    but in my case, both fmt:message and spring:message return always same locale as request - please see
    http://forum.springframework.org/showthread.php?t=17883
    Last edited by robyn; May 14th, 2006 at 08:12 PM.

Similar Threads

  1. Replies: 17
    Last Post: Jan 2nd, 2007, 01:43 PM
  2. Replies: 4
    Last Post: May 12th, 2006, 02:50 AM
  3. Hibernate Long Session Per Flow?
    By akw in forum Web Flow
    Replies: 21
    Last Post: Dec 12th, 2005, 08:06 PM
  4. Replies: 9
    Last Post: Nov 1st, 2005, 10:36 PM
  5. Loosing my SecureContext
    By sklakken in forum Security
    Replies: 3
    Last Post: Jul 21st, 2005, 01:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •