tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1350241 - in /tomcat/trunk/java/org/apache/catalina: Context.java connector/Response.java core/StandardContext.java startup/FailedContext.java
Date Thu, 14 Jun 2012 13:59:08 GMT
Author: markt
Date: Thu Jun 14 13:59:07 2012
New Revision: 1350241

URL: http://svn.apache.org/viewvc?rev=1350241&view=rev
Log:
Refactor to remove o.a.c -> o.a.c.util dependency

Modified:
    tomcat/trunk/java/org/apache/catalina/Context.java
    tomcat/trunk/java/org/apache/catalina/connector/Response.java
    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/trunk/java/org/apache/catalina/startup/FailedContext.java

Modified: tomcat/trunk/java/org/apache/catalina/Context.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Context.java?rev=1350241&r1=1350240&r2=1350241&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/Context.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Context.java Thu Jun 14 13:59:07 2012
@@ -17,6 +17,7 @@
 package org.apache.catalina;
 
 import java.net.URL;
+import java.util.Locale;
 import java.util.Set;
 
 import javax.servlet.ServletContainerInitializer;
@@ -157,7 +158,9 @@ public interface Context extends Contain
 
     /**
      * Return the Locale to character set mapper for this Context.
+     * @deprecated Use {@link #getCharset(Locale)}
      */
+    @Deprecated
     public CharsetMapper getCharsetMapper();
 
 
@@ -165,11 +168,22 @@ public interface Context extends Contain
      * Set the Locale to character set mapper for this Context.
      *
      * @param mapper The new mapper
+     *
+     * @deprecated
      */
+    @Deprecated
     public void setCharsetMapper(CharsetMapper mapper);
 
 
     /**
+     * Obtain the character set name to use with the given Locale. Note that
+     * different Contexts may have different mappings of Locale to character
+     * set.
+     */
+    public String getCharset(Locale locale);
+
+
+    /**
      * Return the URL of the XML descriptor for this context.
      */
     public URL getConfigFile();

Modified: tomcat/trunk/java/org/apache/catalina/connector/Response.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Response.java?rev=1350241&r1=1350240&r2=1350241&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Response.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Response.java Thu Jun 14 13:59:07 2012
@@ -44,7 +44,6 @@ import org.apache.catalina.Globals;
 import org.apache.catalina.Session;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.security.SecurityUtil;
-import org.apache.catalina.util.CharsetMapper;
 import org.apache.catalina.util.DateTool;
 import org.apache.catalina.util.RequestUtil;
 import org.apache.catalina.util.SessionConfig;
@@ -788,12 +787,10 @@ public class Response
             return;
         }
 
-        CharsetMapper cm = getContext().getCharsetMapper();
-        String charset = cm.getCharset( locale );
-        if ( charset != null ){
+        String charset = getContext().getCharset(locale);
+        if (charset != null) {
             coyoteResponse.setCharacterEncoding(charset);
         }
-
     }
 
 

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1350241&r1=1350240&r2=1350241&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Thu Jun 14 13:59:07 2012
@@ -33,6 +33,7 @@ import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.Stack;
@@ -1408,7 +1409,9 @@ public class StandardContext extends Con
 
     /**
      * Return the Locale to character set mapper for this Context.
+     * @deprecated Use {@link #getCharset(Locale)}
      */
+    @Deprecated
     @Override
     public CharsetMapper getCharsetMapper() {
 
@@ -1433,6 +1436,7 @@ public class StandardContext extends Con
      *
      * @param mapper The new mapper
      */
+    @Deprecated
     @Override
     public void setCharsetMapper(CharsetMapper mapper) {
 
@@ -1445,6 +1449,13 @@ public class StandardContext extends Con
 
     }
 
+
+    @Override
+    public String getCharset(Locale locale) {
+        return getCharsetMapper().getCharset(locale);
+    }
+
+
     /**
      * Return the URL of the XML descriptor for this context.
      */

Modified: tomcat/trunk/java/org/apache/catalina/startup/FailedContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/FailedContext.java?rev=1350241&r1=1350240&r2=1350241&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/FailedContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/FailedContext.java Thu Jun 14 13:59:07 2012
@@ -19,6 +19,7 @@ package org.apache.catalina.startup;
 import java.beans.PropertyChangeListener;
 import java.io.File;
 import java.net.URL;
+import java.util.Locale;
 import java.util.Set;
 
 import javax.naming.directory.DirContext;
@@ -315,12 +316,17 @@ public class FailedContext extends Lifec
     @Override
     public boolean getAvailable() { return false; }
 
+    @Deprecated
     @Override
     public CharsetMapper getCharsetMapper() { return null; }
+    @Deprecated
     @Override
     public void setCharsetMapper(CharsetMapper mapper) { /* NO-OP */ }
 
     @Override
+    public String getCharset(Locale locale) { return null; }
+
+    @Override
     public boolean getConfigured() { return false; }
     @Override
     public void setConfigured(boolean configured) { /* NO-OP */ }



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


Mime
View raw message