remm        02/02/20 22:09:51

  Modified:    catalina/src/share/org/apache/catalina/connector Tag:
                        tomcat_40_branch ResponseBase.java
  Log:
  - Port patch.
  - Implement a more dynamic behavior for setting the charset.
  - Patch submitted by Hans Bergsten.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.16.2.5  +14 -7     
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/ResponseBase.java
  
  Index: ResponseBase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/ResponseBase.java,v
  retrieving revision 1.16.2.4
  retrieving revision 1.16.2.5
  diff -u -r1.16.2.4 -r1.16.2.5
  --- ResponseBase.java 20 Feb 2002 18:40:16 -0000      1.16.2.4
  +++ ResponseBase.java 21 Feb 2002 06:09:51 -0000      1.16.2.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/ResponseBase.java,v
 1.16.2.4 2002/02/20 18:40:16 remm Exp $
  - * $Revision: 1.16.2.4 $
  - * $Date: 2002/02/20 18:40:16 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/ResponseBase.java,v
 1.16.2.5 2002/02/21 06:09:51 remm Exp $
  + * $Revision: 1.16.2.5 $
  + * $Date: 2002/02/21 06:09:51 $
    *
    * ====================================================================
    *
  @@ -89,7 +89,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.16.2.4 $ $Date: 2002/02/20 18:40:16 $
  + * @version $Revision: 1.16.2.5 $ $Date: 2002/02/21 06:09:51 $
    */
   
   public abstract class ResponseBase
  @@ -891,11 +891,18 @@
               return;     // Ignore any call from an included servlet
   
           this.locale = locale;
  -        if ((this.encoding == null) && (this.context != null)) {
  +        if (this.context != null) {
               CharsetMapper mapper = context.getCharsetMapper();
               this.encoding = mapper.getCharset(locale);
  -            if ((contentType != null) && (contentType.indexOf(';') < 0)) {
  -                contentType = contentType + ";charset=" + encoding;
  +            if (contentType != null) {
  +                if (contentType.indexOf(';') < 0) {
  +                    contentType = contentType + ";charset=" + encoding;
  +                } else {
  +                    // Replace the previous charset
  +                    int i = contentType.indexOf(';');
  +                    contentType = contentType.substring(0, i) 
  +                        + ";charset=" + encoding;
  +                }
               }
           }
   
  
  
  

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

Reply via email to