dgraham 2003/02/25 20:51:09 Modified: src/share/org/apache/struts/taglib/html HtmlTag.java Log: The tag now uses RequestUtils.retrieveUserLocale for looking up the appropriate locale. Using that method protects us from needlessly creating a session for PR# 17371. Revision Changes Path 1.10 +10 -22 jakarta-struts/src/share/org/apache/struts/taglib/html/HtmlTag.java Index: HtmlTag.java =================================================================== RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/taglib/html/HtmlTag.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- HtmlTag.java 8 Dec 2002 06:54:51 -0000 1.9 +++ HtmlTag.java 26 Feb 2003 04:51:09 -0000 1.10 @@ -7,7 +7,7 @@ * * The Apache Software License, Version 1.1 * - * Copyright (c) 1999-2001 The Apache Software Foundation. All rights + * Copyright (c) 1999-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -70,6 +70,7 @@ import org.apache.struts.Globals; import org.apache.struts.util.MessageResources; +import org.apache.struts.util.RequestUtils; import org.apache.struts.util.ResponseUtils; @@ -238,28 +239,15 @@ */ protected Locale getCurrentLocale() { - // Create a new session if necessary - HttpSession session = pageContext.getSession(); - if (this.locale && (session == null)) { - session = ((HttpServletRequest) this.pageContext.getRequest()).getSession(); - } - - // Return any currently set Locale in our session - Locale current = (Locale) session.getAttribute(Globals.LOCALE_KEY); - if (current != null) { - return (current); - } - - // If client doesn't specify a locale preference in header then default for - // server will be returned. - current = pageContext.getRequest().getLocale(); + Locale userLocale = RequestUtils.retrieveUserLocale(pageContext, Globals.LOCALE_KEY); // Store a new current Locale, if requested if (this.locale) { - session.setAttribute(Globals.LOCALE_KEY, current); + HttpSession session = ((HttpServletRequest) this.pageContext.getRequest()).getSession(); + session.setAttribute(Globals.LOCALE_KEY, userLocale); } - return (current); + return userLocale; } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]