Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2004-07-29 Thread Costin Manolache
Jan Luehe wrote:
Bill,

luehe   2004/07/27 17:43:17
 Modified:coyote/src/java/org/apache/coyote Response.java
 Log:
 Fixed Bugtraq 6152759 ("Default charset not included in Content-Type
 response header if no char encoding was specified").
 According to the Servlet 2.4 spec, calling:
   ServletResponse.setContentType("text/html");
 must yield these results:
   ServletResponse.getContentType() -> "text/html"
   Content-Type response header -> "text/html;charset=ISO-8859-1"
 Notice the absence of a charset in the result of getContentType(), but
 its presence (set to the default ISO-8859-1) in the Content-Type
 response header.
 Tomcat is currently not including the default charset in the
 Content-Type response header if no char encoding was specified.

-1.  This gets us right back to the same old problem where we are sending
back "image/gif; charset=iso-8859-1", and nobody can read the response.

yes, sorry, I had forgotten about that case.
If we're not going to assume that the UA believes that the default 
encoding
is iso-8859-1 (which is what we are doing now),

I think the reason the spec added the requirement to clearly identify
the encoding in all cases (when using a writer) was because many
browsers let the user choose
which encoding to apply to responses that don't declare their encoding,
which will result in data corruption if the response was encoded in
ISO-8859-1 and the user picks an incompatible encoding.
AFAIK browsers let the user choose the encoding even if it is specified.
And they do that exactly because some 'smart' servers send a wrong 
encoding ( like 8859-1 ) even if the content is different.

If you are using a foreign charset, your data will be either 8859-x ( 
with x!= 1 ) or UTF8. In any case - it will never be 8859-1 ( since the 
foreign characters won't exist there ). So the requirement is to 
basically break any foreign language.



then I'd suggest simply
doing:
   setCharacterEncoding(getCharacterEncoding());
in Response.getWriter (since the spec only requires that we identify the
charset when using a Writer, and we don't really know what it is when 
using
OutputStream).

The problem with this is that if you call getWriter() (with your 
proposed fix) followed by getContentType(), the returned content type
will include a charset, which is against the spec of getContentType():

  * If no character encoding has been specified, the
  * charset parameter is omitted.
This is why we need to append the default charset to the value of the
Content-Type header, if no char encoding has been specified.

On one side it is required to identify the charset in all cases ( to not 
confuse browsers ), but on the other you are not allowed to specify the 
real encoding from the writer, if it wasn't specified :-) ?

Costin
Jan

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


cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2004-07-28 Thread luehe
luehe   2004/07/28 11:51:44

  Modified:coyote/src/java/org/apache/coyote Response.java
  Log:
  Reverted previous patch, because it would reintroduce the problem of sending
  "image/gif; charset=iso-8859-1", which nobody can read.
  
  Revision  ChangesPath
  1.34  +0 -28 
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.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- Response.java 28 Jul 2004 00:43:17 -  1.33
  +++ Response.java 28 Jul 2004 18:51:44 -  1.34
  @@ -21,7 +21,6 @@
   
   import org.apache.tomcat.util.buf.ByteChunk;
   import org.apache.tomcat.util.http.MimeHeaders;
  -import org.apache.tomcat.util.http.ContentType;
   
   /**
* Response object.
  @@ -525,33 +524,6 @@
   return ret;
   }
   
  -
  -/**
  - * Returns the value of the Content-Type response header, based on the
  - * current return value of getContentType().
  - *
  - * Notice that while the charset parameter must be omitted from the
  - * return value of ServletResponse.getContentType() if no character
  - * encoding has been specified, the spec requires that a charset (default:
  - * ISO-8859-1) always be included in the Content-Type response header
  - *
  - * @return Value of Content-Type response header
  - */
  -public String getContentTypeResponseHeader() {
  -
  -String header = getContentType();
  -if (header != null) {
  -if (!ContentType.hasCharset(header)) {
  -// Must communicate response encoding to client
  -header = header + ";charset="
  -+ Constants.DEFAULT_CHARACTER_ENCODING;
  -}
  -}
  -
  -return header;
  -}
  -
  -
   public void setContentLength(int contentLength) {
   this.contentLength = contentLength;
   }
  
  
  

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



Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2004-07-28 Thread Jan Luehe
Jan Luehe wrote:
Remy,
Remy Maucherat wrote:
Jan Luehe wrote:
Bill,
then I'd suggest simply
doing:
   setCharacterEncoding(getCharacterEncoding());
in Response.getWriter (since the spec only requires that we identify 
the
charset when using a Writer, and we don't really know what it is 
when using
OutputStream).


The problem with this is that if you call getWriter() (with your 
proposed fix) followed by getContentType(), the returned content type
will include a charset, which is against the spec of getContentType():

  * If no character encoding has been specified, the
  * charset parameter is omitted.
This is why we need to append the default charset to the value of the
Content-Type header, if no char encoding has been specified.

This is not acceptable, and is not an option, so you shouldn't be 
using "we need", because we won't ;)

This is why I said "we need" instead of "we will". ;-)
I agreed with Bill's proposed solution in principle (include charset
only when using writer), but pointed out that his proposed patch
would break ServletResponse.getContentType(), which is why I said that
if we were to include the default charset (if no charset was specified
and if a writer was being used), we'd have to do it at the time of
generating the header.
I'll reply to your other mail shortly.
Actually, I just found that Bill's patch would fix the issue and
be compliant with the spec:
ServletResponse.getWriter:
 * If the response's character encoding has not been
 * specified as described in getCharacterEncoding
 * (i.e., the method just returns the default value
 * ISO-8859-1), getWriter
 * updates it to ISO-8859-1.
So it *is* expected for getContentType() to include a
"charset=ISO-8859-1" if no char encoding had been specified
before getWriter() was called.
This way, the charset would automatically be included in the
Content-Type response header.
I'll revert my patch and apply Bill's solution.
Thanks, Bill!
Jan

Jan

The right solution is IMO to point out the issues to the specification 
people.

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

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


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


Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2004-07-28 Thread Jan Luehe
Remy,
Remy Maucherat wrote:
Jan Luehe wrote:
Bill,
then I'd suggest simply
doing:
   setCharacterEncoding(getCharacterEncoding());
in Response.getWriter (since the spec only requires that we identify the
charset when using a Writer, and we don't really know what it is when 
using
OutputStream).

The problem with this is that if you call getWriter() (with your 
proposed fix) followed by getContentType(), the returned content type
will include a charset, which is against the spec of getContentType():

  * If no character encoding has been specified, the
  * charset parameter is omitted.
This is why we need to append the default charset to the value of the
Content-Type header, if no char encoding has been specified.

This is not acceptable, and is not an option, so you shouldn't be using 
"we need", because we won't ;)
This is why I said "we need" instead of "we will". ;-)
I agreed with Bill's proposed solution in principle (include charset
only when using writer), but pointed out that his proposed patch
would break ServletResponse.getContentType(), which is why I said that
if we were to include the default charset (if no charset was specified
and if a writer was being used), we'd have to do it at the time of
generating the header.
I'll reply to your other mail shortly.
Jan

The right solution is IMO to point out the issues to the specification 
people.

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

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


Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2004-07-28 Thread Remy Maucherat
Jan Luehe wrote:
Bill,
then I'd suggest simply
doing:
   setCharacterEncoding(getCharacterEncoding());
in Response.getWriter (since the spec only requires that we identify the
charset when using a Writer, and we don't really know what it is when 
using
OutputStream).

The problem with this is that if you call getWriter() (with your 
proposed fix) followed by getContentType(), the returned content type
will include a charset, which is against the spec of getContentType():

  * If no character encoding has been specified, the
  * charset parameter is omitted.
This is why we need to append the default charset to the value of the
Content-Type header, if no char encoding has been specified.
This is not acceptable, and is not an option, so you shouldn't be using 
"we need", because we won't ;)
The right solution is IMO to point out the issues to the specification 
people.

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


Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2004-07-28 Thread Jan Luehe
Bill,

luehe   2004/07/27 17:43:17
 Modified:coyote/src/java/org/apache/coyote Response.java
 Log:
 Fixed Bugtraq 6152759 ("Default charset not included in Content-Type
 response header if no char encoding was specified").
 According to the Servlet 2.4 spec, calling:
   ServletResponse.setContentType("text/html");
 must yield these results:
   ServletResponse.getContentType() -> "text/html"
   Content-Type response header -> "text/html;charset=ISO-8859-1"
 Notice the absence of a charset in the result of getContentType(), but
 its presence (set to the default ISO-8859-1) in the Content-Type
 response header.
 Tomcat is currently not including the default charset in the
 Content-Type response header if no char encoding was specified.

-1.  This gets us right back to the same old problem where we are sending
back "image/gif; charset=iso-8859-1", and nobody can read the response.
yes, sorry, I had forgotten about that case.
If we're not going to assume that the UA believes that the default encoding
is iso-8859-1 (which is what we are doing now),
I think the reason the spec added the requirement to clearly identify
the encoding in all cases (when using a writer) was because many
browsers let the user choose
which encoding to apply to responses that don't declare their encoding,
which will result in data corruption if the response was encoded in
ISO-8859-1 and the user picks an incompatible encoding.
then I'd suggest simply
doing:
   setCharacterEncoding(getCharacterEncoding());
in Response.getWriter (since the spec only requires that we identify the
charset when using a Writer, and we don't really know what it is when using
OutputStream).
The problem with this is that if you call getWriter() (with your 
proposed fix) followed by getContentType(), the returned content type
will include a charset, which is against the spec of getContentType():

  * If no character encoding has been specified, the
  * charset parameter is omitted.
This is why we need to append the default charset to the value of the
Content-Type header, if no char encoding has been specified.
Jan



This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication in 
error, please notify us immediately by e-mail and then delete all copies of this 
message and any attachments.
In addition you should be aware that ordinary (unencrypted) e-mail sent through the 
Internet is not secure. Do not send confidential or sensitive information, such as 
social security numbers, account numbers, personal identification numbers and 
passwords, to us via ordinary (unencrypted) e-mail.


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

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


Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2004-07-27 Thread Bill Barker

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 27, 2004 5:43 PM
Subject: cvs commit:
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java


> luehe   2004/07/27 17:43:17
>
>   Modified:coyote/src/java/org/apache/coyote Response.java
>   Log:
>   Fixed Bugtraq 6152759 ("Default charset not included in Content-Type
>   response header if no char encoding was specified").
>
>   According to the Servlet 2.4 spec, calling:
>
> ServletResponse.setContentType("text/html");
>
>   must yield these results:
>
> ServletResponse.getContentType() -> "text/html"
>
> Content-Type response header -> "text/html;charset=ISO-8859-1"
>
>   Notice the absence of a charset in the result of getContentType(), but
>   its presence (set to the default ISO-8859-1) in the Content-Type
>   response header.
>
>   Tomcat is currently not including the default charset in the
>   Content-Type response header if no char encoding was specified.
>

-1.  This gets us right back to the same old problem where we are sending
back "image/gif; charset=iso-8859-1", and nobody can read the response.

If we're not going to assume that the UA believes that the default encoding
is iso-8859-1 (which is what we are doing now), then I'd suggest simply
doing:
   setCharacterEncoding(getCharacterEncoding());
in Response.getWriter (since the spec only requires that we identify the
charset when using a Writer, and we don't really know what it is when using
OutputStream).



This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication in 
error, please notify us immediately by e-mail and then delete all copies of this 
message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through the 
Internet is not secure. Do not send confidential or sensitive information, such as 
social security numbers, account numbers, personal identification numbers and 
passwords, to us via ordinary (unencrypted) e-mail.

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

cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2004-07-27 Thread luehe
luehe   2004/07/27 17:43:17

  Modified:coyote/src/java/org/apache/coyote Response.java
  Log:
  Fixed Bugtraq 6152759 ("Default charset not included in Content-Type
  response header if no char encoding was specified").
  
  According to the Servlet 2.4 spec, calling:
  
ServletResponse.setContentType("text/html");
  
  must yield these results:
  
ServletResponse.getContentType() -> "text/html"
  
Content-Type response header -> "text/html;charset=ISO-8859-1"
  
  Notice the absence of a charset in the result of getContentType(), but
  its presence (set to the default ISO-8859-1) in the Content-Type
  response header.
  
  Tomcat is currently not including the default charset in the
  Content-Type response header if no char encoding was specified.
  
  Revision  ChangesPath
  1.33  +28 -0 
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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- Response.java 24 Feb 2004 08:54:29 -  1.32
  +++ Response.java 28 Jul 2004 00:43:17 -  1.33
  @@ -21,6 +21,7 @@
   
   import org.apache.tomcat.util.buf.ByteChunk;
   import org.apache.tomcat.util.http.MimeHeaders;
  +import org.apache.tomcat.util.http.ContentType;
   
   /**
* Response object.
  @@ -524,6 +525,33 @@
   return ret;
   }
   
  +
  +/**
  + * Returns the value of the Content-Type response header, based on the
  + * current return value of getContentType().
  + *
  + * Notice that while the charset parameter must be omitted from the
  + * return value of ServletResponse.getContentType() if no character
  + * encoding has been specified, the spec requires that a charset (default:
  + * ISO-8859-1) always be included in the Content-Type response header
  + *
  + * @return Value of Content-Type response header
  + */
  +public String getContentTypeResponseHeader() {
  +
  +String header = getContentType();
  +if (header != null) {
  +if (!ContentType.hasCharset(header)) {
  +// Must communicate response encoding to client
  +header = header + ";charset="
  ++ Constants.DEFAULT_CHARACTER_ENCODING;
  +}
  +}
  +
  +return header;
  +}
  +
  +
   public void setContentLength(int contentLength) {
   this.contentLength = contentLength;
   }
  
  
  

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



Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2003-11-16 Thread Bill Barker

- Original Message - 
From: "Remy Maucherat" <[EMAIL PROTECTED]>
To: "Tomcat Developers List" <[EMAIL PROTECTED]>
Sent: Sunday, November 16, 2003 3:05 AM
Subject: Re: cvs commit:
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java


> [EMAIL PROTECTED] wrote:
> > billbarker2003/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.
>
> Constants.DEFAULT_CHARACTER_ENCODING is equal to iso-9959-1, so I do not
> understand how my patch prenvented setting the charset to iso-latin-1.
>
> At this point, if we could avoid gratuitous fancy fixes, it would be a
> lot better ...
>

If I explicitly call response.setCharacterEncoding("iso-8859-1"), it means I
expect that the charset will be in the Content-Type header.  If it is not
sent, then non-western-european browsers are likely to mangle my page by
using whatever their default encoding is.  Of course, iso-latin-1 is just a
standard alias for iso-8859-1.

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


This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication in 
error, please notify us immediately by e-mail and then delete all copies of this 
message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through the 
Internet is not secure. Do not send confidential or sensitive information, such as 
social security numbers, account numbers, personal identification numbers and 
passwords, to us via ordinary (unencrypted) e-mail.

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

Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2003-11-16 Thread Remy Maucherat
[EMAIL PROTECTED] wrote:
billbarker2003/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.
Constants.DEFAULT_CHARACTER_ENCODING is equal to iso-9959-1, so I do not 
understand how my patch prenvented setting the charset to iso-latin-1.

At this point, if we could avoid gratuitous fancy fixes, it would be a 
lot better ...

Remy



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


cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2003-11-15 Thread billbarker
billbarker2003/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  ChangesPath
  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 -  1.30
  +++ Response.java 16 Nov 2003 05:20:23 -  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]



cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2003-11-11 Thread remm
remm2003/11/11 12:56:56

  Modified:coyote/src/java/org/apache/coyote Response.java
  Log:
  - Don't add the charset if it's the default one.
  - BTW, the patch which caused that is bad ! getContentType gets always
called, and it generates a lot of GC ! This needs to be optimized further.
  
  Revision  ChangesPath
  1.30  +5 -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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Response.java 14 Oct 2003 19:21:25 -  1.29
  +++ Response.java 11 Nov 2003 20:56:56 -  1.30
  @@ -552,9 +552,11 @@
   
   String ret = contentType;
   
  -if (ret != null && characterEncoding != null) {
  -ret += ";charset=";
  -ret += characterEncoding;
  +if (ret != null 
  +&& characterEncoding != null
  +&& !(Constants.DEFAULT_CHARACTER_ENCODING.equals
  + (characterEncoding))) {
  +ret = ret + ";charset=" + characterEncoding;
   }
   
   return ret;
  
  
  

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



cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2003-10-14 Thread luehe
luehe   2003/10/14 12:21:25

  Modified:coyote/src/java/org/apache/coyote Response.java
  Log:
  Take into accout that there may be other content-type params whose
  names end in "charset" when determining response charset
  
  Revision  ChangesPath
  1.29  +41 -21
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.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Response.java 13 Oct 2003 23:36:23 -  1.28
  +++ Response.java 14 Oct 2003 19:21:25 -  1.29
  @@ -93,8 +93,6 @@
*/
   private static Locale DEFAULT_LOCALE = Locale.getDefault();
   
  -private static final int BEGIN_CHARSET_VALUE = "charset=".length();
  -
   
   // - Instance Variables
   
  @@ -486,11 +484,13 @@
* been set via a call to response.setContentType(), response.setLocale(),
* or response.setCharacterEncoding().
*
  - * @param contentType the content type
  + * @param type the content type
*/
  -public void setContentType(String contentType) {
  +public void setContentType(String type) {
  +
  +int semicolonIndex = -1;
   
  -if (contentType == null) {
  +if (type == null) {
   this.contentType = null;
   return;
   }
  @@ -499,33 +499,53 @@
* Remove the charset param (if any) from the Content-Type, and use it
* to set the response encoding.
* The most recent response encoding setting will be appended to the
  - * response Content-Type (as its charset param) by getContentType();
  + * response's Content-Type (as its charset param) by getContentType();
*/
  -int beginCharsetParam = contentType.indexOf("charset=");
  -if (beginCharsetParam == -1) {
  -// no charset
  -this.contentType = contentType;
  -return;
  +boolean hasCharset = false;
  +int len = type.length();
  +int index = type.indexOf(';');
  +while (index != -1) {
  +semicolonIndex = index;
  +index++;
  +while (index < len && Character.isSpace(type.charAt(index))) {
  +index++;
  +}
  +if (index+8 < len
  +&& type.charAt(index) == 'c'
  +&& type.charAt(index+1) == 'h'
  +&& type.charAt(index+2) == 'a'
  +&& type.charAt(index+3) == 'r'
  +&& type.charAt(index+4) == 's'
  +&& type.charAt(index+5) == 'e'
  +&& type.charAt(index+6) == 't'
  +&& type.charAt(index+7) == '=') {
  +hasCharset = true;
  +break;
  +}
  +index = type.indexOf(';', index);
   }
   
  -this.contentType = contentType.substring(0, beginCharsetParam);
  -// Trim the semicolon preceding the charset
  -int charsetSemi = this.contentType.lastIndexOf(';');
  -if (charsetSemi != -1) {
  -this.contentType = this.contentType.substring(0, charsetSemi);
  +if (!hasCharset) {
  +this.contentType = type;
  +return;
   }
  -String tail = contentType.substring(beginCharsetParam);
  +
  +this.contentType = type.substring(0, semicolonIndex);
  +String tail = type.substring(index+8);
   int nextParam = tail.indexOf(';');
   String charsetValue = null;
   if (nextParam != -1) {
   this.contentType += tail.substring(nextParam);
  -charsetValue = tail.substring(BEGIN_CHARSET_VALUE, nextParam);
  +charsetValue = tail.substring(0, nextParam);
   } else {
  -charsetValue = tail.substring(BEGIN_CHARSET_VALUE);
  +charsetValue = tail;
   }
  +
   // The charset value may be quoted, but must not contain any quotes.
  -charsetValue = charsetValue.replace('"', ' ');
  -this.characterEncoding = charsetValue.trim();
  +if (charsetValue != null && charsetValue.length() > 0) {
  +charsetValue = charsetValue.replace('"', ' ');
  +this.characterEncoding = charsetValue.trim();
  +}
   }
   
   public String getContentType() {
  
  
  

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



Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2003-10-14 Thread Jan Luehe
Bill,

  this.contentType = contentType.substring(0, beginCharsetParam);
 -String tail = contentType.substring(beginCharsetParam + 1);
 +// Trim the semicolon preceding the charset
 +int charsetSemi = this.contentType.lastIndexOf(';');


This is still not working for me.  Now I can't do stuff like:
  setContentType("text/html;charset=utf-8;   altcharset=iso-latin-1");
I don't know any current browser that uses this, but it is completely valid
in RFC 2616.
can you describe how is this failing for you?
The above setContentType results in a content type setting of
  "text/html;   altcharset=iso-latin-1"

with the response charset set to "utf-8".

I don't think I changed the previous behaviour in any way that would 
break things, but I might be wrong. :)

Let me know.

Jan



 +if (charsetSemi != -1) {
 +this.contentType = this.contentType.substring(0,
charsetSemi);

 +}
 +String tail = contentType.substring(beginCharsetParam);
  int nextParam = tail.indexOf(';');
  String charsetValue = null;
  if (nextParam != -1) {
  this.contentType += tail.substring(nextParam);
 -charsetValue = tail.substring(beginCharsetValue,
nextParam);

 +charsetValue = tail.substring(BEGIN_CHARSET_VALUE,
nextParam);

  } else {
 -charsetValue = tail.substring(beginCharsetValue);
 +charsetValue = tail.substring(BEGIN_CHARSET_VALUE);
  }
  // The charset value may be quoted, but must not contain any
quotes.

  charsetValue = charsetValue.replace('"', ' ');




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


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


Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2003-10-13 Thread Bill Barker
>   @@ -510,14 +509,19 @@
>}
>
>this.contentType = contentType.substring(0, beginCharsetParam);
>   -String tail = contentType.substring(beginCharsetParam + 1);
>   +// Trim the semicolon preceding the charset
>   +int charsetSemi = this.contentType.lastIndexOf(';');

This is still not working for me.  Now I can't do stuff like:
  setContentType("text/html;charset=utf-8;   altcharset=iso-latin-1");

I don't know any current browser that uses this, but it is completely valid
in RFC 2616.

>   +if (charsetSemi != -1) {
>   +this.contentType = this.contentType.substring(0,
charsetSemi);
>   +}
>   +String tail = contentType.substring(beginCharsetParam);
>int nextParam = tail.indexOf(';');
>String charsetValue = null;
>if (nextParam != -1) {
>this.contentType += tail.substring(nextParam);
>   -charsetValue = tail.substring(beginCharsetValue,
nextParam);
>   +charsetValue = tail.substring(BEGIN_CHARSET_VALUE,
nextParam);
>} else {
>   -charsetValue = tail.substring(beginCharsetValue);
>   +charsetValue = tail.substring(BEGIN_CHARSET_VALUE);
>}
>// The charset value may be quoted, but must not contain any
quotes.
>charsetValue = charsetValue.replace('"', ' ');




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



cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2003-10-13 Thread luehe
luehe   2003/10/13 16:36:23

  Modified:coyote/src/java/org/apache/coyote Response.java
  Log:
  Support separators other than space preceding "charset="
  
  Revision  ChangesPath
  1.28  +13 -9 
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.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Response.java 13 Oct 2003 21:53:45 -  1.27
  +++ Response.java 13 Oct 2003 23:36:23 -  1.28
  @@ -482,6 +482,10 @@
   /**
* Sets the content type.
*
  + * This method must preserve any response charset that may already have 
  + * been set via a call to response.setContentType(), response.setLocale(),
  + * or response.setCharacterEncoding().
  + *
* @param contentType the content type
*/
   public void setContentType(String contentType) {
  @@ -497,12 +501,7 @@
* The most recent response encoding setting will be appended to the
* response Content-Type (as its charset param) by getContentType();
*/
  -int beginCharsetValue = BEGIN_CHARSET_VALUE;
  -int beginCharsetParam = contentType.indexOf(";charset=");
  -if (beginCharsetParam == -1) {
  -beginCharsetParam = contentType.indexOf("; charset=");
  -beginCharsetValue++;
  -}
  +int beginCharsetParam = contentType.indexOf("charset=");
   if (beginCharsetParam == -1) {
   // no charset
   this.contentType = contentType;
  @@ -510,14 +509,19 @@
   }
   
   this.contentType = contentType.substring(0, beginCharsetParam);
  -String tail = contentType.substring(beginCharsetParam + 1);
  +// Trim the semicolon preceding the charset
  +int charsetSemi = this.contentType.lastIndexOf(';');
  +if (charsetSemi != -1) {
  +this.contentType = this.contentType.substring(0, charsetSemi);
  +}
  +String tail = contentType.substring(beginCharsetParam);
   int nextParam = tail.indexOf(';');
   String charsetValue = null;
   if (nextParam != -1) {
   this.contentType += tail.substring(nextParam);
  -charsetValue = tail.substring(beginCharsetValue, nextParam);
  +charsetValue = tail.substring(BEGIN_CHARSET_VALUE, nextParam);
   } else {
  -charsetValue = tail.substring(beginCharsetValue);
  +charsetValue = tail.substring(BEGIN_CHARSET_VALUE);
   }
   // The charset value may be quoted, but must not contain any quotes.
   charsetValue = charsetValue.replace('"', ' ');
  
  
  

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



Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2003-10-13 Thread Bill Barker
>   +/*
>   + * Remove the charset param (if any) from the Content-Type, and
use it
>   + * to set the response encoding.
>   + * The most recent response encoding setting will be appended
to the
>   + * response Content-Type (as its charset param) by
getContentType();
>   + */
>   +int beginCharsetValue = BEGIN_CHARSET_VALUE;
>   +int beginCharsetParam = contentType.indexOf(";charset=");
>   +if (beginCharsetParam == -1) {
>   +beginCharsetParam = contentType.indexOf("; charset=");
>   +beginCharsetValue++;
>   +}

Of course, this doesn't work if I do setContentType("text/html;
charset=utf-8");.

>   +if (beginCharsetParam == -1) {
>   +// no charset
>   +this.contentType = contentType;
>   +return;
>   +}



This message is intended only for the use of the person(s) listed above as the 
intended recipient(s), and may contain information that is PRIVILEGED and 
CONFIDENTIAL.  If you are not an intended recipient, you may not read, copy, or 
distribute this message or any attachment. If you received this communication in 
error, please notify us immediately by e-mail and then delete all copies of this 
message and any attachments.

In addition you should be aware that ordinary (unencrypted) e-mail sent through the 
Internet is not secure. Do not send confidential or sensitive information, such as 
social security numbers, account numbers, personal identification numbers and 
passwords, to us via ordinary (unencrypted) e-mail.

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

cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2003-10-13 Thread luehe
luehe   2003/10/13 14:53:45

  Modified:coyote/src/java/org/apache/coyote Response.java
  Log:
  Fixed Bugtraq 4934442 ("Response Content-Type has no charset even
 though setCharacterEncoding was called")
  
  This fixes the problem where a response char setting via
  response.setCharacterEncoding() or response.setLocale() is not
  preserved by a call to response.setContentType() with a content type
  that has no charset, ie., response.getContentType(), following this
  sequence of calls:
  
response.setCharacterEncoding("Shift_Jis");
response.setContentType("text/html")
  
  used to return "text/html" instead of "text/html;charset=Shift_Jis",
  which violates the servlet spec.
  
  Revision  ChangesPath
  1.27  +59 -34
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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- Response.java 2 Sep 2003 21:34:38 -   1.26
  +++ Response.java 13 Oct 2003 21:53:45 -  1.27
  @@ -64,7 +64,6 @@
   import java.util.Locale;
   
   import org.apache.tomcat.util.buf.ByteChunk;
  -import org.apache.tomcat.util.http.ContentType;
   import org.apache.tomcat.util.http.MimeHeaders;
   
   /**
  @@ -87,15 +86,18 @@
   }
   
   
  -// - Instance Variables
  -
  -
  -   /**
  +// - Class Variables
  +
  +/**
* Default locale as mandated by the spec.
*/
   private static Locale DEFAULT_LOCALE = Locale.getDefault();
  -
  -   
  +
  +private static final int BEGIN_CHARSET_VALUE = "charset=".length();
  +
  +
  +// - Instance Variables
  +
   /**
* Status code.
*/
  @@ -471,44 +473,67 @@
   return;
   
characterEncoding = charset;
  -
  -String type = this.contentType;
  - if (type != null) {
  - int start = type.indexOf("charset=");
  - if ( start != -1 ) {
  - int end = type.indexOf(';', start+8);
  - if (end >= 0) 
  - type = type.substring(0,start+8)
  - + charset + type.substring(end-1);
  - else 
  - type = type.substring(0,start+8) + charset;
  - this.contentType = type;
  - } else {
  - int end = type.indexOf(';');
  - if (end >= 0) {
  - type = type.substring(0, end) + ";charset=" + charset;
  - } else {
  - type = type + ";charset=" + charset;
  - }
  - }
  - setContentType( type );
  -}
   }
   
   public String getCharacterEncoding() {
   return characterEncoding;
   }
   
  +/**
  + * Sets the content type.
  + *
  + * @param contentType the content type
  + */
   public void setContentType(String contentType) {
  -this.contentType = contentType;
  -String encoding = ContentType.getCharsetFromContentType(contentType);
  -if (encoding != null) {
  -characterEncoding = encoding;
  +
  +if (contentType == null) {
  +this.contentType = null;
  +return;
   }
  +
  +/*
  + * Remove the charset param (if any) from the Content-Type, and use it
  + * to set the response encoding.
  + * The most recent response encoding setting will be appended to the
  + * response Content-Type (as its charset param) by getContentType();
  + */
  +int beginCharsetValue = BEGIN_CHARSET_VALUE;
  +int beginCharsetParam = contentType.indexOf(";charset=");
  +if (beginCharsetParam == -1) {
  +beginCharsetParam = contentType.indexOf("; charset=");
  +beginCharsetValue++;
  +}
  +if (beginCharsetParam == -1) {
  +// no charset
  +this.contentType = contentType;
  +return;
  +}
  +
  +this.contentType = contentType.substring(0, beginCharsetParam);
  +String tail = contentType.substring(beginCharsetParam + 1);
  +int nextParam = tail.indexOf(';');
  +String charsetValue = null;
  +if (nextParam != -1) {
  +this.contentType += tail.substring(nextParam);
  +charsetValue = tail.substring(beginCharsetValue, nextParam);
  +} else {
  +charsetValue = tail.substring(beginCharsetValue);
  +}
  +// The charset value may be quoted, but must not contain any quotes.
  +charsetValue = charsetValue.replace('"', ' ');
  + 

cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2003-08-25 Thread luehe
luehe   2003/08/25 14:35:06

  Modified:coyote/src/java/org/apache/coyote Response.java
  Log:
  More javadocs fixes
  
  Revision  ChangesPath
  1.25  +1 -1  
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.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Response.java 25 Aug 2003 21:27:03 -  1.24
  +++ Response.java 25 Aug 2003 21:35:06 -  1.25
  @@ -461,7 +461,7 @@
   
   /*
* Overrides the name of the character encoding used in the body
  - * of the request. This method must be called prior to writing output
  + * of the response. This method must be called prior to writing output
* using getWriter().
*
* @param charset String containing the name of the chararacter encoding.
  
  
  

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



cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2003-08-25 Thread luehe
luehe   2003/08/25 14:27:04

  Modified:coyote/src/java/org/apache/coyote Response.java
  Log:
  javadocs fix
  
  Revision  ChangesPath
  1.24  +2 -2  
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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Response.java 23 May 2003 17:26:27 -  1.23
  +++ Response.java 25 Aug 2003 21:27:03 -  1.24
  @@ -461,8 +461,8 @@
   
   /*
* Overrides the name of the character encoding used in the body
  - * of the request. This method must be called prior to reading
  - * request parameters or reading input using getReader().
  + * of the request. This method must be called prior to writing output
  + * using getWriter().
*
* @param charset String containing the name of the chararacter encoding.
*/
  
  
  

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



cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2002-11-09 Thread remm
remm2002/11/09 09:12:05

  Modified:coyote/src/java/org/apache/coyote Response.java
  Log:
  - Refactor special header handling.
  - The special headers are now set in the protocol handler, which allows enforcing
the protocol (as it is not possible to remove headers from the MimeHeaders).
  - This may not be compatible with Coyote JK 2. Please review.
  
  Revision  ChangesPath
  1.16  +15 -10
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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Response.java 12 Sep 2002 06:42:11 -  1.15
  +++ Response.java 9 Nov 2002 17:12:04 -   1.16
  @@ -142,7 +142,7 @@
   protected String contentLanguage = null;
   protected String characterEncoding = Constants.DEFAULT_CHARACTER_ENCODING;
   protected int contentLength = -1;
  -private Locale locale = Constants.DEFAULT_LOCALE;
  +private Locale locale = null;//Constants.DEFAULT_LOCALE;
   
   /**
* Holds request error exception.
  @@ -311,7 +311,8 @@
   // Reset the headers only if this is the main request,
   // not for included
   contentType = Constants.DEFAULT_CONTENT_TYPE;
  -locale = Constants.DEFAULT_LOCALE;
  +locale = null;//Constants.DEFAULT_LOCALE;
  +contentLanguage = null;
   characterEncoding = Constants.DEFAULT_CHARACTER_ENCODING;
   contentLength = -1;
   
  @@ -386,9 +387,9 @@
   setContentLength( cL );
   return true;
   } catch( NumberFormatException ex ) {
  -// Do nothing - the spec doesn't have any "throws" 
  -// and the user might know what he's doing
  -return false;
  +// Do nothing - the spec doesn't have any "throws" 
  +// and the user might know what he's doing
  +return false;
   }
   }
   if( name.equalsIgnoreCase( "Content-Language" ) ) {
  @@ -437,12 +438,18 @@
   value.append('-');
   value.append(country);
   }
  -// only one header !
  -headers.setValue("Content-Language").setString(value.toString());
  +contentLanguage = value.toString();
   }
   
   }
   
  +/**
  + * Return the content language.
  + */
  +public String getContentLanguage() {
  +return contentLanguage;
  +}
  +
   /*
* Overrides the name of the character encoding used in the body
* of the request. This method must be called prior to reading
  @@ -488,7 +495,6 @@
   if (encoding != null) {
   characterEncoding = encoding;
   }
  -headers.setValue("Content-Type").setString(contentType);
   }
   
   public String getContentType() {
  @@ -497,7 +503,6 @@
   
   public void setContentLength(int contentLength) {
   this.contentLength = contentLength;
  -headers.setValue("Content-Length").setInt(contentLength);
   }
   
   public int getContentLength() {
  @@ -520,7 +525,7 @@
   
   contentType = Constants.DEFAULT_CONTENT_TYPE;
   contentLanguage = null;
  -locale = Constants.DEFAULT_LOCALE;
  +locale = null;//Constants.DEFAULT_LOCALE;
   characterEncoding = Constants.DEFAULT_CHARACTER_ENCODING;
   contentLength = -1;
   status = 200;
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2002-04-08 Thread costin

costin  02/04/08 16:07:11

  Modified:coyote/src/java/org/apache/coyote Response.java
  Log:
  sendHeaders() must send the notification - that's what the javadoc says :-)
  
  Now jk adapter works fine.
  
  Revision  ChangesPath
  1.10  +1 -1  
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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Response.java 8 Apr 2002 22:56:22 -   1.9
  +++ Response.java 8 Apr 2002 23:07:11 -   1.10
  @@ -403,7 +403,7 @@
*  interceptors to fix headers.
*/
   public void sendHeaders() throws IOException {
  -// XXX This code doesn't send any notification :-)
  +action(ActionCode.ACTION_COMMIT, this);
commited = true;
   }
   
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2002-03-10 Thread remm

remm02/03/10 23:51:20

  Modified:coyote/src/java/org/apache/coyote Response.java
  Log:
  - Both the tester and Watchdog like to get the country code added to the language.
Returning the language only is correct according to the HTTP spec, so is it really 
required ?
  
  Revision  ChangesPath
  1.7   +11 -2 
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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Response.java 8 Mar 2002 23:48:32 -   1.6
  +++ Response.java 11 Mar 2002 07:51:20 -  1.7
  @@ -403,6 +403,7 @@
* the default encoding
*/
   public void setLocale(Locale locale) {
  +
   if (locale == null) {
   return;  // throw an exception?
   }
  @@ -412,9 +413,17 @@
   
   // Set the contentLanguage for header output
   contentLanguage = locale.getLanguage();
  +if ((contentLanguage != null) && (contentLanguage.length() > 0)) {
  +String country = locale.getCountry();
  +StringBuffer value = new StringBuffer(contentLanguage);
  +if ((country != null) && (country.length() > 0)) {
  +value.append('-');
  +value.append(country);
  +}
  +// only one header !
  +headers.setValue("Content-Language").setString(value.toString());
  +}
   
  - // only one header !
  - headers.setValue("Content-Language").setString(contentLanguage);
   }
   
   public String getCharacterEncoding() {
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote Response.java

2002-03-08 Thread remm

remm02/03/08 15:48:32

  Modified:coyote/src/java/org/apache/coyote Response.java
  Log:
  - Cleanup.
  
  Revision  ChangesPath
  1.6   +9 -7  
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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Response.java 7 Mar 2002 22:43:29 -   1.5
  +++ Response.java 8 Mar 2002 23:48:32 -   1.6
  @@ -136,7 +136,7 @@
   
   
   /**
  - * HTTP specific fields (remove them ?)
  + * HTTP specific fields.
*/
   protected String contentType = Constants.DEFAULT_CONTENT_TYPE;
   protected String contentLanguage = null;
  @@ -145,13 +145,15 @@
   private Locale locale = Constants.DEFAULT_LOCALE;
   
   /**
  - * FIXME: Remove.
  + * Holds request error exception.
*/
  -// holds request error exception
  -// set this just once during request processing
  -Exception errorException = null;
  -// holds request error URI
  -String errorURI = null;
  +protected Exception errorException = null;
  +
  +
  +/**
  + * Request error URI.
  + */
  +protected String errorURI = null;
   
   
   // - Properties
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: