Announcement Announcement Module
Collapse
No announcement yet.
Bug with Cookie Locale Resolver Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bug with Cookie Locale Resolver

    I have tested my code using both Spring 1.2.6 and 2.0-M2 and with both jetty 6 and Tomcat 5.5 using Sun's JDK 1.5.x

    It seems there is a bug in CookieLocaleResolver - it fails to set the cookie when I call setLocale() in a form controller:


    protected ModelAndView onSubmit(HttpServletRequest req, HttpServletResponse resp, Object command, BindException errors) throws Exception {
    Form form = (Form)command;
    RequestContextUtils.getLocaleResolver(req).setLoca le(req, resp, form.getLocale());
    return new ModelAndView(getSuccessView());
    }

    Stepping thru sping's code eventually leads to response.addCookie() being called but both tomcat 5.5 and jetty 6 seems to ignore it. Inspecting the browser's cookies and adding debugging code to print out all cookies confirms that the cookie is NOT being added at all.

    Changing the cookie name and maxAge did not improve things...

    I wonder if this is related to combination of redirect and response.addCookie()? See http://www.jguru.com/faq/view.jsp?EID=53251

    Switching to SessionLocaleResolver works beautifully but I would rather use cookie based locale...

    Any help would be much appreciated...
Working...
X