cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util CharsetMapper.java

2005-01-05 Thread remm
remm2005/01/05 02:00:45

  Modified:catalina/src/share/org/apache/catalina/util
CharsetMapper.java
  Log:
  - Also match laguage_country. This seemed to have been missing.
  
  Revision  ChangesPath
  1.7   +8 -3  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/CharsetMapper.java
  
  Index: CharsetMapper.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/CharsetMapper.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- CharsetMapper.java5 Jan 2005 09:36:46 -   1.6
  +++ CharsetMapper.java5 Jan 2005 10:00:45 -   1.7
  @@ -100,10 +100,15 @@
* @param locale The locale for which to calculate a character set
*/
   public String getCharset(Locale locale) {
  -// Match full language_country_variant first, then language only
  +// Match full language_country_variant first, then language_country, 
  +// then language only
   String charset = map.getProperty(locale.toString());
   if (charset == null) {
  -charset = map.getProperty(locale.getLanguage());
  +charset = map.getProperty(locale.getLanguage() + _ 
  ++ locale.getCountry());
  +if (charset == null) {
  +charset = map.getProperty(locale.getLanguage());
  +}
   }
   return (charset);
   }
  
  
  

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



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util CharsetMapper.java

2005-01-05 Thread Remy Maucherat
Costin Manolache wrote:
Maybe:
* @author Jason Hunter, as part of the book Java Servlet Programming
* (O'Reilly). See a href=http://www.servlets.com/book;
* http://www.servlets.com/book/a for more information.
?
I think it is fair to respect the author wish for attribution.
Given that the board recomends against @author tags and they may be 
someday removed, it doesn't matter that much...
I am all in favor of giving proper attribution (author tags), but -1 on 
anything which restricts the ASF's copyright on the code (like 
advertising clauses in this case).

As a result, I have to agree with all that pointed out that the code 
should be rewritten (in this case, the encoding list must be 
reconstructed from scratch).

Rémy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util CharsetMapper.java

2005-01-05 Thread Costin Manolache
Remy Maucherat wrote:
Costin Manolache wrote:
Maybe:
* @author Jason Hunter, as part of the book Java Servlet Programming
* (O'Reilly). See a href=http://www.servlets.com/book;
* http://www.servlets.com/book/a for more information.
?
I think it is fair to respect the author wish for attribution.
Given that the board recomends against @author tags and they may be 
someday removed, it doesn't matter that much...

I am all in favor of giving proper attribution (author tags), but -1 on 
anything which restricts the ASF's copyright on the code (like 
advertising clauses in this case).

As a result, I have to agree with all that pointed out that the code 
should be rewritten (in this case, the encoding list must be 
reconstructed from scratch).

Rémy
There is no advertising clause in this. He made it clear that the code 
is donated to ASF, under ASF license. Mentioning that the author 
developed the code while working on a book or while being paid by a 
company can't be that bad.

I don't understand why ASF is so advertising-fobic when it comes to 
authors or companies that donate code or employee time to ASF, but until 
recently strictly required advertisment for the code owner ( ASF ) not 
only in the code, but also on the web site.


Costin

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


Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util CharsetMapper.java

2005-01-05 Thread Remy Maucherat
Costin Manolache wrote:
Remy Maucherat wrote:
There is no advertising clause in this. He made it clear that the code 
is donated to ASF, under ASF license. Mentioning that the author 
developed the code while working on a book or while being paid by a 
company can't be that bad.

I don't understand why ASF is so advertising-fobic when it comes to 
authors or companies that donate code or employee time to ASF, but until 
recently strictly required advertisment for the code owner ( ASF ) not 
only in the code, but also on the web site.
I suppose you're not the one getting the cellphone calls while on 
vacation about lawyers from large companies being very unhappy about 
this comment, which is anything but clear.

The ASF also doesn't do advertisements. This comment was an advertisment.
That's the end of the discussion as far as I am concerned.
Rémy
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util CharsetMapper.java

2005-01-04 Thread remm
remm2005/01/04 14:14:42

  Modified:util/java/org/apache/tomcat/util/http
LocaleToCharsetMap.java
   catalina/src/share/org/apache/catalina/util
CharsetMapper.java
  Log:
  - Remove legally questionable comment. The code was properly donated to the 
ASF.
  
  Revision  ChangesPath
  1.3   +2 -14 
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/LocaleToCharsetMap.java
  
  Index: LocaleToCharsetMap.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/LocaleToCharsetMap.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LocaleToCharsetMap.java   24 Feb 2004 08:50:04 -  1.2
  +++ LocaleToCharsetMap.java   4 Jan 2005 22:14:42 -   1.3
  @@ -14,15 +14,6 @@
*  limitations under the License.
*/
   
  -/*
  - *
  - * This class was originally written by Jason Hunter [EMAIL PROTECTED]
  - * as part of the book Java Servlet Programming (O'Reilly).  
  - * See http://www.servlets.com/book for more information.
  - * Used by Sun Microsystems with permission.
  - *
  - */
  -
   package org.apache.tomcat.util.http;
   
   import java.util.*;
  @@ -30,11 +21,8 @@
   /** 
* A mapping to determine the (somewhat arbitrarily) preferred charset for 
* a given locale.  Supports all locales recognized in JDK 1.1.
  - * This class was originally written by Jason Hunter [EMAIL PROTECTED]
  - * as part of the book Java Servlet Programming (O'Reilly).
  - * See a href=http://www.servlets.com/book;
  - * http://www.servlets.com/book/a for more information.
  - * Used by Sun Microsystems with permission.
  + * 
  + * @author Jason Hunter
*/
   public class LocaleToCharsetMap {
   
  
  
  
  1.5   +2 -8  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/CharsetMapper.java
  
  Index: CharsetMapper.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/CharsetMapper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CharsetMapper.java29 Aug 2004 16:46:13 -  1.4
  +++ CharsetMapper.java4 Jan 2005 22:14:42 -   1.5
  @@ -14,13 +14,6 @@
* limitations under the License.
*/
   
  -/*
  - * This class is based on a class originally written by Jason Hunter
  - * [EMAIL PROTECTED] as part of the book Java Servlet Programming
  - * (O'Reilly).  See http://www.servlets.com/book for more information.
  - * Used by Sun Microsystems with permission.
  - */
  -
   package org.apache.catalina.util;
   
   
  @@ -38,6 +31,7 @@
* it loads, or by subclassing it (to change the algorithm) and then using
* your own version for a particular web application.
*
  + * @author Jason Hunter
* @author Craig R. McClanahan
* @version $Date$ $Version$
*/
  
  
  

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



Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util CharsetMapper.java

2005-01-04 Thread Costin Manolache
Maybe:
* @author Jason Hunter, as part of the book Java Servlet Programming
* (O'Reilly). See a href=http://www.servlets.com/book;
* http://www.servlets.com/book/a for more information.
?
I think it is fair to respect the author wish for attribution.
Given that the board recomends against @author tags and they may be 
someday removed, it doesn't matter that much...

Costin
[EMAIL PROTECTED] wrote:
remm2005/01/04 14:14:42
  Modified:util/java/org/apache/tomcat/util/http
LocaleToCharsetMap.java
   catalina/src/share/org/apache/catalina/util
CharsetMapper.java
  Log:
  - Remove legally questionable comment. The code was properly donated to the ASF.
  
  Revision  ChangesPath
  1.3   +2 -14 jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/LocaleToCharsetMap.java
  
  Index: LocaleToCharsetMap.java
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/http/LocaleToCharsetMap.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LocaleToCharsetMap.java	24 Feb 2004 08:50:04 -	1.2
  +++ LocaleToCharsetMap.java	4 Jan 2005 22:14:42 -	1.3
  @@ -14,15 +14,6 @@
*  limitations under the License.
*/
   
  -/*
  - *
  - * This class was originally written by Jason Hunter [EMAIL PROTECTED]
  - * as part of the book Java Servlet Programming (O'Reilly).  
  - * See http://www.servlets.com/book for more information.
  - * Used by Sun Microsystems with permission.
  - *
  - */
  -
   package org.apache.tomcat.util.http;
   
   import java.util.*;
  @@ -30,11 +21,8 @@
   /** 
* A mapping to determine the (somewhat arbitrarily) preferred charset for 
* a given locale.  Supports all locales recognized in JDK 1.1.
  - * This class was originally written by Jason Hunter [EMAIL PROTECTED]
  - * as part of the book Java Servlet Programming (O'Reilly).
  - * See a href=http://www.servlets.com/book;
  - * http://www.servlets.com/book/a for more information.
  - * Used by Sun Microsystems with permission.
  + * 
  + * @author Jason Hunter
*/
   public class LocaleToCharsetMap {
   
  
  
  
  1.5   +2 -8  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/CharsetMapper.java
  
  Index: CharsetMapper.java
  ===
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/CharsetMapper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CharsetMapper.java	29 Aug 2004 16:46:13 -	1.4
  +++ CharsetMapper.java	4 Jan 2005 22:14:42 -	1.5
  @@ -14,13 +14,6 @@
* limitations under the License.
*/
   
  -/*
  - * This class is based on a class originally written by Jason Hunter
  - * [EMAIL PROTECTED] as part of the book Java Servlet Programming
  - * (O'Reilly).  See http://www.servlets.com/book for more information.
  - * Used by Sun Microsystems with permission.
  - */
  -
   package org.apache.catalina.util;
   
   
  @@ -38,6 +31,7 @@
* it loads, or by subclassing it (to change the algorithm) and then using
* your own version for a particular web application.
*
  + * @author Jason Hunter
* @author Craig R. McClanahan
* @version $Date$ $Version$
*/

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


cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util CharsetMapper.java

2002-08-09 Thread patrickl

patrickl2002/08/09 09:22:36

  Modified:catalina/src/share/org/apache/catalina Context.java
   catalina/src/share/org/apache/catalina/core
StandardContext.java
   catalina/src/share/org/apache/catalina/startup
WebRuleSet.java
   catalina/src/share/org/apache/catalina/util
CharsetMapper.java
  Log:
  In the Servlet 2.4 spec section 5.4 on i18n, the deployment descriptor gets new 
stuff for mapping locale to character encoding.
  Submitted by:  Bob Herrmann ([EMAIL PROTECTED])
  
  Revision  ChangesPath
  1.3   +13 -4 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Context.java
  
  Index: Context.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/Context.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Context.java  2 Aug 2002 01:37:42 -   1.2
  +++ Context.java  9 Aug 2002 16:22:36 -   1.3
  @@ -481,6 +481,15 @@
   
   
   /**
  + * Add a Locale Encoding Mapping (see Sec 5.4 of Servlet spec 2.4)
  + *
  + * @param locale locale to map an encoding for
  + * @param encoding encoding to be used for a give locale
  + */
  +public void addLocaleEncodingMappingParameter(String locale, String encoding);
  +
  +
  +/**
* Add a local EJB resource reference for this web application.
*
* @param ejb New local EJB resource reference
  
  
  
  1.4   +15 -4 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StandardContext.java  9 Aug 2002 02:07:12 -   1.3
  +++ StandardContext.java  9 Aug 2002 16:22:36 -   1.4
  @@ -1512,6 +1512,17 @@
   
   
   /**
  + * Add a Locale Encoding Mapping (see Sec 5.4 of Servlet spec 2.4)
  + *
  + * @param locale locale to map an encoding for
  + * @param encoding encoding to be used for a give locale
  + */
  +public void addLocaleEncodingMappingParameter(String locale, String encoding){
  +getCharsetMapper().addCharsetMappingFromDeploymentDescriptor(locale, 
encoding);
  +}
  +
  +
  +/**
* Add a local EJB resource reference for this web application.
*
* @param ejb New EJB resource reference
  
  
  
  1.4   +9 -4  
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/WebRuleSet.java
  
  Index: WebRuleSet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/WebRuleSet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- WebRuleSet.java   8 Aug 2002 18:33:19 -   1.3
  +++ WebRuleSet.java   9 Aug 2002 16:22:36 -   1.4
  @@ -385,6 +385,11 @@
   digester.addCallMethod(prefix + web-app/welcome-file-list/welcome-file,
  addWelcomeFile, 0);
   
  +digester.addCallMethod(prefix + 
web-app/locale-encoding-mapping-list/locale-encoding-mapping,
  +  addLocaleEncodingMappingParameter, 2);
  +digester.addCallParam(prefix + 
web-app/locale-encoding-mapping-list/locale-encoding-mapping/locale, 0);
  +digester.addCallParam(prefix + 
web-app/locale-encoding-mapping-list/locale-encoding-mapping/encoding, 1);
  +
   }
   
   
  
  
  
  1.2   +14 -1 
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/CharsetMapper.java
  
  Index: CharsetMapper.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/util/CharsetMapper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CharsetMapper.java18 Jul 2002 16:47:45 -  1.1
  +++ CharsetMapper.java9 Aug 2002 16:22:36 -   1.2
  @@ -171,5 +171,18 @@
   
   }
   
  +/**
  + * The deployment descriptor can have a
  + * locale-encoding-mapping-list element which describes the
  + * webapp's desired mapping from locale to charset.  This method
  + * gets called when processing the web.xml file for a context
  + *
  + * @param locale The locale for a character set
  + * @param charset The charset to be associated with the locale
  + */
  +public void addCharsetMappingFromDeploymentDescriptor(String locale,String 
charset) {
  +map.put( locale,