tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billbar...@apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/resources LocalStrings.properties LocalStrings_es.properties LocalStrings_fr.properties LocalStrings_ja.properties
Date Sat, 08 Jan 2005 21:14:21 GMT
billbarker    2005/01/08 13:14:21

  Modified:    src/share/org/apache/tomcat/modules/generators
                        ErrorHandler.java StaticInterceptor.java
               src/share/org/apache/tomcat/resources
                        LocalStrings.properties LocalStrings_es.properties
                        LocalStrings_fr.properties
                        LocalStrings_ja.properties
  Log:
  Remove dependancy on o.a.t.u.http.LocaleToCharsetMap, since it doesn't exist anymore.
  
  Revision  Changes    Path
  1.32      +43 -9     jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/ErrorHandler.java
  
  Index: ErrorHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/ErrorHandler.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- ErrorHandler.java	21 Nov 2004 03:59:16 -0000	1.31
  +++ ErrorHandler.java	8 Jan 2005 21:14:21 -0000	1.32
  @@ -30,7 +30,6 @@
   import org.apache.tomcat.core.TomcatException;
   import org.apache.tomcat.util.net.URL;
   import org.apache.tomcat.util.http.HttpMessages;
  -import org.apache.tomcat.util.http.LocaleToCharsetMap;
   import org.apache.tomcat.util.log.Log;
   import org.apache.tomcat.util.qlog.Logger;
   import org.apache.tomcat.util.res.StringManager;
  @@ -45,10 +44,25 @@
       private Context rootContext=null;
       boolean showDebugInfo=true;
       int defaultRedirectStatus=301;
  +    private String charset = null;
       
       public ErrorHandler() {
       }
   
  +    /**
  +     * Set the charset to use for error page generation.
  +     */
  +    public void setUseCharset(String ucs) {
  +	charset = ucs;
  +    }
  +
  +    /**
  +     * Get the charset to use for error page generation.
  +     */
  +    public String getUseCharset() {
  +	return charset;
  +    }
  +
       public void setShowDebugInfo( boolean b ) {
   	showDebugInfo=b;
       }
  @@ -436,12 +450,14 @@
   	getManager("org.apache.tomcat.resources");
       int sbNote=0;
       boolean showDebugInfo=true;
  +    private String useCharset;
       
  -    NotFoundHandler(BaseInterceptor bi, boolean showDebugInfo) {
  +    NotFoundHandler(ErrorHandler bi, boolean showDebugInfo) {
   	//	setOrigin( Handler.ORIGIN_INTERNAL );
   	name="tomcat.notFoundHandler";
   	setModule(bi);
   	this.showDebugInfo=showDebugInfo;
  +	useCharset = bi.getUseCharset();
       }
   
       public void doService(Request req, Response res)
  @@ -449,7 +465,10 @@
       {
   	String msg=(String)req.getAttribute("javax.servlet.error.message");
   
  -	String charset = LocaleToCharsetMap.getCharset(Locale.getDefault());
  +	String charset = useCharset;
  +	if(charset == null) {
  +	    charset = req.getCharEncoding();
  +	}
   	if (charset == null) {
   	    res.setContentType("text/html");
   	} else {
  @@ -519,12 +538,14 @@
   	getManager("org.apache.tomcat.resources");
       int sbNote=0;
       boolean showDebugInfo=true;
  +    private String useCharset;
       
  -    ExceptionHandler(BaseInterceptor bi, boolean showDebugInfo) {
  +    ExceptionHandler(ErrorHandler bi, boolean showDebugInfo) {
   	//	setOrigin( Handler.ORIGIN_INTERNAL );
   	name="tomcat.exceptionHandler";
   	setModule( bi );
   	this.showDebugInfo=showDebugInfo;
  +	useCharset = bi.getUseCharset();
       }
   
       public void doService(Request req, Response res)
  @@ -560,7 +581,10 @@
   
   	// only include <head>...<body> if reset was successful
   	if ( needsHead ) {
  -           String charset = LocaleToCharsetMap.getCharset(Locale.getDefault());
  +	    String charset = useCharset;
  +	    if(charset == null) {
  +		charset = req.getCharEncoding();
  +	    }
              if (charset == null)
                  res.setContentType("text/html");
              else {
  @@ -637,12 +661,14 @@
   	getManager("org.apache.tomcat.resources");
       int sbNote=0;
       boolean showDebugInfo=true;
  +    private String useCharset;
       
  -    StatusHandler(BaseInterceptor bi, boolean showDebugInfo) {
  +    StatusHandler(ErrorHandler bi, boolean showDebugInfo) {
   	//setOrigin( Handler.ORIGIN_INTERNAL );
   	name="tomcat.statusHandler";
   	setModule( bi );
   	this.showDebugInfo=showDebugInfo;
  +	useCharset = bi.getUseCharset();
       }
       
       // We don't want interceptors called for redirect
  @@ -664,7 +690,10 @@
   	// don't set a content type if we are answering If-Modified-Since.
   	// Proxy caches might update their cached content-type with this
   	// info (mod_proxy does it). Martin Algesten 15th Oct, 2002.
  -	String charset = LocaleToCharsetMap.getCharset(Locale.getDefault());
  +	String charset = useCharset;
  +	if(charset == null) {
  +	    charset = req.getCharEncoding();
  +	}
   	if (charset == null) {
   	    res.setContentType("text/html");
   	} else {
  @@ -761,11 +790,13 @@
   	getManager("org.apache.tomcat.resources");
       int sbNote=0;
       int defaultRedirectStatus=301;
  +    String useCharset;
   
  -    RedirectHandler(BaseInterceptor bi) {
  +    RedirectHandler(ErrorHandler bi) {
   	//setOrigin( Handler.ORIGIN_INTERNAL );
   	name="tomcat.redirectHandler";
   	setModule( bi );
  +	useCharset = bi.getUseCharset();
       }
   
       public void setDefaultRedirectStatus( int status ) {
  @@ -790,7 +821,10 @@
   
   	if( debug>0) ctx.log("Redirect " + location + " " + req );
   
  -	String charset = LocaleToCharsetMap.getCharset(Locale.getDefault());
  +	String charset = useCharset;
  +	if(charset == null) {
  +	    charset = req.getCharEncoding();
  +	}
   	if (charset == null) {
   	    res.setContentType("text/html");
   	} else {
  
  
  
  1.32      +1 -2      jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/StaticInterceptor.java
  
  Index: StaticInterceptor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/generators/StaticInterceptor.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- StaticInterceptor.java	25 Feb 2004 06:52:40 -0000	1.31
  +++ StaticInterceptor.java	8 Jan 2005 21:14:21 -0000	1.32
  @@ -39,7 +39,6 @@
   import org.apache.tomcat.core.TomcatException;
   import org.apache.tomcat.util.buf.UEncoder;
   import org.apache.tomcat.util.http.AcceptLanguage;
  -import org.apache.tomcat.util.http.LocaleToCharsetMap;
   import org.apache.tomcat.util.http.MimeHeaders;
   import org.apache.tomcat.util.io.FileUtil;
   import org.apache.tomcat.util.res.StringManager;
  @@ -596,7 +595,7 @@
   
           if( defCharset != null ) {
               if( "locale".equals(defCharset))
  -                charset=LocaleToCharsetMap.getCharset(locale);
  +                charset=sm.getString("defaultservlet.charset");
               else
                   charset=defCharset;
           }
  
  
  
  1.18      +2 -1      jakarta-tomcat/src/share/org/apache/tomcat/resources/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/resources/LocalStrings.properties,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- LocalStrings.properties	25 Feb 2004 07:25:48 -0000	1.17
  +++ LocalStrings.properties	8 Jan 2005 21:14:21 -0000	1.18
  @@ -24,6 +24,7 @@
   defaultservlet.upto=Up to:
   defaultservlet.subdirectories=Subdirectories:
   defaultservlet.files=Files:
  +defaultservlet.charset=iso-8859-1
   
   #ErrorHandler / error handlers
   defaulterrorpage.originalrequest=Original request:
  
  
  
  1.20      +2 -1      jakarta-tomcat/src/share/org/apache/tomcat/resources/LocalStrings_es.properties
  
  Index: LocalStrings_es.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/resources/LocalStrings_es.properties,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- LocalStrings_es.properties	25 Feb 2004 07:25:48 -0000	1.19
  +++ LocalStrings_es.properties	8 Jan 2005 21:14:21 -0000	1.20
  @@ -23,6 +23,7 @@
   defaultservlet.upto=Ir a:
   defaultservlet.subdirectories=Subdirectorios:
   defaultservlet.files=Archivos:
  +defaultservlet.charset=iso-8859-1
   
   #ErrorHandler / error handlers
   defaulterrorpage.originalrequest=Request original:
  
  
  
  1.9       +2 -1      jakarta-tomcat/src/share/org/apache/tomcat/resources/LocalStrings_fr.properties
  
  Index: LocalStrings_fr.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/resources/LocalStrings_fr.properties,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- LocalStrings_fr.properties	25 Feb 2004 07:25:48 -0000	1.8
  +++ LocalStrings_fr.properties	8 Jan 2005 21:14:21 -0000	1.9
  @@ -23,6 +23,7 @@
   defaultservlet.upto=Jusqu''à:
   defaultservlet.subdirectories=Sous-Dossiers:
   defaultservlet.files=Fichiers:
  +defaultservlet.charset=iso-8859-1
   
   #ErrorHandler / error handlers
   defaulterrorpage.originalrequest=Requête originale:
  
  
  
  1.3       +2 -1      jakarta-tomcat/src/share/org/apache/tomcat/resources/LocalStrings_ja.properties
  
  Index: LocalStrings_ja.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/resources/LocalStrings_ja.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LocalStrings_ja.properties	25 Feb 2004 07:25:48 -0000	1.2
  +++ LocalStrings_ja.properties	8 Jan 2005 21:14:21 -0000	1.3
  @@ -23,6 +23,7 @@
   defaultservlet.upto=\u4e0a\u4f4d:
   defaultservlet.subdirectories=\u30b5\u30d6\u30c7\u30a3\u30ec\u30af\u30c8\u30ea:
   defaultservlet.files=\u30d5\u30a1\u30a4\u30eb:
  +defaultservlet.charset=shift_jis
   
   #ErrorHandler / error handlers
   defaulterrorpage.originalrequest=\u5143\u306e\u30ea\u30af\u30a8\u30b9\u30c8:
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message