chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1135821 - in /chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings: impl/ spi/atompub/ spi/webservices/
Date Tue, 14 Jun 2011 21:56:30 GMT
Author: fmui
Date: Tue Jun 14 21:56:30 2011
New Revision: 1135821

URL: http://svn.apache.org/viewvc?rev=1135821&view=rev
Log:
fixed and improved locale handling

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java?rev=1135821&r1=1135820&r2=1135821&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingImpl.java
Tue Jun 14 21:56:30 2011
@@ -115,6 +115,28 @@ public class CmisBindingImpl implements 
 
         }
 
+        // locale
+        String language = sessionParameters.get(SessionParameter.LOCALE_ISO639_LANGUAGE);
+        if (language != null) {
+            language = language.trim();
+            if (language.length() > 0) {
+                String country = sessionParameters.get(SessionParameter.LOCALE_ISO3166_COUNTRY);
+                if (country != null) {
+                    country = country.trim();
+                    if (country.length() > 0) {
+                        country = "-" + country;
+                    }
+                } else {
+                    country = "";
+                }
+
+                String acceptLanguage = language + country;
+                if ((acceptLanguage.indexOf('\n') == -1) && (acceptLanguage.indexOf('\r')
== -1)) {
+                    session.put(CmisBindingsHelper.ACCEPT_LANGUAGE, acceptLanguage);
+                }
+            }
+        }
+
         // set up caches
         clearAllCaches();
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java?rev=1135821&r1=1135820&r2=1135821&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java
Tue Jun 14 21:56:30 2011
@@ -33,10 +33,11 @@ import org.apache.chemistry.opencmis.com
  */
 public final class CmisBindingsHelper {
 
-    public static final String REPOSITORY_INFO_CACHE = "org.apache.chemistry.opencmis.bindings.repositoryInfoCache";
-    public static final String TYPE_DEFINTION_CACHE = "org.apache.chemistry.opencmis.bindings.typeDefintionCache";
-    public static final String SPI_OBJECT = "org.apache.chemistry.opencmis.bindings.spi.object";
-    public static final String AUTHENTICATION_PROVIDER_OBJECT = "org.apache.chemistry.opencmis.bindings.auth.object";
+    public static final String REPOSITORY_INFO_CACHE = "org.apache.chemistry.opencmis.binding.repositoryInfoCache";
+    public static final String TYPE_DEFINTION_CACHE = "org.apache.chemistry.opencmis.binding.typeDefintionCache";
+    public static final String SPI_OBJECT = "org.apache.chemistry.opencmis.binding.spi.object";
+    public static final String AUTHENTICATION_PROVIDER_OBJECT = "org.apache.chemistry.opencmis.binding.auth.object";
+    public static final String ACCEPT_LANGUAGE = "org.apache.chemistry.opencmis.binding.acceptLanguage";
 
     /**
      * Private constructor.

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java?rev=1135821&r1=1135820&r2=1135821&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/HttpUtils.java
Tue Jun 14 21:56:30 2011
@@ -157,17 +157,8 @@ public class HttpUtils {
             }
 
             // locale
-            if (session.get(SessionParameter.LOCALE_ISO639_LANGUAGE) instanceof String) {
-                String language = (String) session.get(SessionParameter.LOCALE_ISO639_LANGUAGE);
-                String country = "";
-                if (session.get(SessionParameter.LOCALE_ISO3166_COUNTRY) instanceof String)
{
-                    country = "-" + (String) session.get(SessionParameter.LOCALE_ISO3166_COUNTRY);
-                }
-
-                String acceptLanguage = language + country;
-                if ((acceptLanguage.indexOf('\n') == -1) && (acceptLanguage.indexOf('\r')
== -1)) {
-                    conn.setRequestProperty("Accept-Language", acceptLanguage);
-                }
+            if (session.get(CmisBindingsHelper.ACCEPT_LANGUAGE) instanceof String) {
+                conn.setRequestProperty("Accept-Language", session.get(CmisBindingsHelper.ACCEPT_LANGUAGE).toString());
             }
 
             // send data

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java?rev=1135821&r1=1135820&r2=1135821&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/PortProvider.java
Tue Jun 14 21:56:30 2011
@@ -79,17 +79,8 @@ public class PortProvider extends Abstra
             useCompression = true;
         }
 
-        if (session.get(SessionParameter.LOCALE_ISO639_LANGUAGE) instanceof String) {
-            String language = (String) session.get(SessionParameter.LOCALE_ISO639_LANGUAGE);
-            String country = "";
-            if (session.get(SessionParameter.LOCALE_ISO3166_COUNTRY) instanceof String) {
-                country = "-" + (String) session.get(SessionParameter.LOCALE_ISO3166_COUNTRY);
-            }
-
-            acceptLanguage = language + country;
-            if ((acceptLanguage.indexOf('\n') > -1) || (acceptLanguage.indexOf('\r') >
-1)) {
-                acceptLanguage = null;
-            }
+        if (session.get(CmisBindingsHelper.ACCEPT_LANGUAGE) instanceof String) {
+            acceptLanguage = session.get(CmisBindingsHelper.ACCEPT_LANGUAGE).toString();
         }
     }
 



Mime
View raw message