remm        02/03/27 19:41:53

  Modified:    coyote/src/java/org/apache/coyote/tomcat4 CoyoteRequest.java
  Log:
  - Apply patch submitted by Ryan Lubke <[EMAIL PROTECTED]>:
    When dealing with preferred locales from a client (Accept-Language),
  the CoyoteRequest class (org.apache.coyote.tomcat4) doesn't correctly
  handle locales with variants (i.e. en-IE-EURO).
  RFC 2616 states that the following for language-range of
  Accept-Language:
    language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
  
  Revision  Changes    Path
  1.14      +15 -5     
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java
  
  Index: CoyoteRequest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- CoyoteRequest.java        24 Mar 2002 18:48:48 -0000      1.13
  +++ CoyoteRequest.java        28 Mar 2002 03:41:53 -0000      1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java,v
 1.13 2002/03/24 18:48:48 remm Exp $
  - * $Revision: 1.13 $
  - * $Date: 2002/03/24 18:48:48 $
  + * $Header: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/CoyoteRequest.java,v
 1.14 2002/03/28 03:41:53 remm Exp $
  + * $Revision: 1.14 $
  + * $Date: 2002/03/28 03:41:53 $
    *
    * ====================================================================
    *
  @@ -122,7 +122,7 @@
    *
    * @author Remy Maucherat
    * @author Craig R. McClanahan
  - * @version $Revision: 1.13 $ $Date: 2002/03/24 18:48:48 $
  + * @version $Revision: 1.14 $ $Date: 2002/03/28 03:41:53 $
    */
   
   public class CoyoteRequest
  @@ -1999,17 +1999,27 @@
               // Extract the language and country for this entry
               String language = null;
               String country = null;
  +            String variant = null;
               int dash = entry.indexOf('-');
               if (dash < 0) {
                   language = entry;
                   country = "";
  +                variant = "";
               } else {
                   language = entry.substring(0, dash);
                   country = entry.substring(dash + 1);
  +                int vDash = country.indexOf('-');
  +                if (vDash > 0) {
  +                    String cTemp = country.substring(0, vDash);
  +                    variant = country.substring(vDash + 1);
  +                    country = cTemp;
  +                } else {
  +                    variant = "";
  +                }
               }
   
               // Add a new Locale to the list of Locales for this quality level
  -            Locale locale = new Locale(language, country);
  +            Locale locale = new Locale(language, country, variant);
               Double key = new Double(-quality);  // Reverse the order
               ArrayList values = (ArrayList) locales.get(key);
               if (values == null) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to