You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2001/03/17 01:26:45 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/context DefaultCMSetter.java
marcsaeg 01/03/16 16:26:44
Modified: src/share/org/apache/tomcat/context Tag: tomcat_32
DefaultCMSetter.java
Log:
Use the default locale for generated error pages.
Reported by kare@highway.ne.jp (Yoshiyuki Karezaki).
PR: 691
Submitted by: Kazuhiro Kazama
Revision Changes Path
No revision
No revision
1.45.2.9 +20 -4 jakarta-tomcat/src/share/org/apache/tomcat/context/Attic/DefaultCMSetter.java
Index: DefaultCMSetter.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/Attic/DefaultCMSetter.java,v
retrieving revision 1.45.2.8
retrieving revision 1.45.2.9
diff -u -r1.45.2.8 -r1.45.2.9
--- DefaultCMSetter.java 2000/11/11 02:56:57 1.45.2.8
+++ DefaultCMSetter.java 2001/03/17 00:26:39 1.45.2.9
@@ -151,7 +151,11 @@
public void doService(Request req, Response res)
throws Exception
{
- res.setContentType("text/html"); // ISO-8859-1 default
+ String charset = LocaleToCharsetMap.getCharset(Locale.getDefault());
+ if (charset == null || charset.equalsIgnoreCase("ISO-8859-1"))
+ res.setContentType("text/html");
+ else
+ res.setContentType("text/html; charset=" + charset);
String requestURI = (String)req.
getAttribute("javax.servlet.include.request_uri");
@@ -226,7 +230,11 @@
return;
}
- res.setContentType("text/html");
+ String charset = LocaleToCharsetMap.getCharset(Locale.getDefault());
+ if (charset == null || charset.equalsIgnoreCase("ISO-8859-1"))
+ res.setContentType("text/html");
+ else
+ res.setContentType("text/html; charset=" + charset);
res.setStatus( 500 );
StringBuffer buf = new StringBuffer();
@@ -331,7 +339,11 @@
String msg=(String)req.getAttribute("javax.servlet.error.message");
String errorURI = res.getErrorURI();
- res.setContentType("text/html");
+ String charset = LocaleToCharsetMap.getCharset(Locale.getDefault());
+ if (charset == null || charset.equalsIgnoreCase("ISO-8859-1"))
+ res.setContentType("text/html");
+ else
+ res.setContentType("text/html; charset=" + charset);
// res is reset !!!
// status is already set
int sc=res.getStatus();
@@ -432,7 +444,11 @@
if( debug>0) ctx.log("Redirect " + location + " " + req );
- res.setContentType("text/html"); // ISO-8859-1 default
+ String charset = LocaleToCharsetMap.getCharset(Locale.getDefault());
+ if (charset == null || charset.equalsIgnoreCase("ISO-8859-1"))
+ res.setContentType("text/html");
+ else
+ res.setContentType("text/html; charset=" + charset);
res.setHeader("Location", location);
StringBuffer buf = new StringBuffer();