billbarker    2003/11/15 21:20:23

  Modified:    coyote/src/java/org/apache/coyote Response.java
  Log:
  Restore the ability to explicitly set the charset to iso-latin-1.
  
  Now, you won't get the charset unless you ask for it (so no more Content-Type: 
image/gif; charset=iso-8859-1).  However, if you call 
response.setCharacterEncoding("iso-9959-1"), you now get it in the respose.
  
  Revision  Changes    Path
  1.31      +10 -3     
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java
  
  Index: Response.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- Response.java     11 Nov 2003 20:56:56 -0000      1.30
  +++ Response.java     16 Nov 2003 05:20:23 -0000      1.31
  @@ -155,6 +155,10 @@
        */
       protected Exception errorException = null;
   
  +    /**
  +     * Has the charset been explicitly set.
  +     */
  +    protected boolean charsetSet = false;
   
       /**
        * Request error URI.
  @@ -321,6 +325,7 @@
           contentLanguage = null;
           characterEncoding = Constants.DEFAULT_CHARACTER_ENCODING;
           contentLength = -1;
  +        charsetSet = false;
   
           status = 200;
           message = null;
  @@ -470,7 +475,8 @@
           if (charset == null)
               return;
   
  -     characterEncoding = charset;
  +        characterEncoding = charset;
  +        charsetSet=true;
       }
   
       public String getCharacterEncoding() {
  @@ -543,6 +549,7 @@
   
           // The charset value may be quoted, but must not contain any quotes.
           if (charsetValue != null && charsetValue.length() > 0) {
  +            charsetSet=true;
               charsetValue = charsetValue.replace('"', ' ');
               this.characterEncoding = charsetValue.trim();
           }
  @@ -554,8 +561,7 @@
   
           if (ret != null 
               && characterEncoding != null
  -            && !(Constants.DEFAULT_CHARACTER_ENCODING.equals
  -                 (characterEncoding))) {
  +            && charsetSet) {
               ret = ret + ";charset=" + characterEncoding;
           }
   
  @@ -589,6 +595,7 @@
           contentLanguage = null;
           locale = DEFAULT_LOCALE;
           characterEncoding = Constants.DEFAULT_CHARACTER_ENCODING;
  +        charsetSet = false;
           contentLength = -1;
           status = 200;
           message = null;
  
  
  

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

Reply via email to