abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r607813 - in /incubator/abdera/java/trunk/server/src: main/java/org/apache/abdera/protocol/server/ main/java/org/apache/abdera/protocol/server/impl/ test/java/org/apache/abdera/test/server/
Date Tue, 01 Jan 2008 07:22:12 GMT
Author: jmsnell
Date: Mon Dec 31 23:22:10 2007
New Revision: 607813

URL: http://svn.apache.org/viewvc?rev=607813&view=rev
Log:
Provide methods for accessing the client's preferred Locale(s)

Modified:
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java
    incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java
    incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/test/server/UtilityTest.java

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java?rev=607813&r1=607812&r2=607813&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/RequestContext.java
Mon Dec 31 23:22:10 2007
@@ -22,6 +22,7 @@
 import java.io.Reader;
 import java.security.Principal;
 import java.util.List;
+import java.util.Locale;
 
 import javax.security.auth.Subject;
 
@@ -54,6 +55,10 @@
   Subject getSubject();
   
   Principal getPrincipal();
+  
+  Locale getPreferredLocale();
+  
+  Locale[] getPreferredLocales();
   
   String getMethod();
   

Modified: incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java?rev=607813&r1=607812&r2=607813&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java
(original)
+++ incubator/abdera/java/trunk/server/src/main/java/org/apache/abdera/protocol/server/impl/HttpServletRequestContext.java
Mon Dec 31 23:22:10 2007
@@ -20,9 +20,11 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
+import java.util.Collections;
 import java.util.Date;
 import java.util.Enumeration;
 import java.util.List;
+import java.util.Locale;
 
 import javax.security.auth.Subject;
 import javax.servlet.http.HttpServletRequest;
@@ -240,5 +242,14 @@
 
   public String getContextPath() {
     return request.getContextPath();
+  }
+  
+  public Locale getPreferredLocale() {
+    return request.getLocale();
+  }
+  
+  public Locale[] getPreferredLocales() {
+    List<Locale> locales = Collections.list(request.getLocales());
+    return locales.toArray(new Locale[locales.size()]);
   }
 }

Modified: incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/test/server/UtilityTest.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/test/server/UtilityTest.java?rev=607813&r1=607812&r2=607813&view=diff
==============================================================================
--- incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/test/server/UtilityTest.java
(original)
+++ incubator/abdera/java/trunk/server/src/test/java/org/apache/abdera/test/server/UtilityTest.java
Mon Dec 31 23:22:10 2007
@@ -24,6 +24,7 @@
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 
 import junit.framework.TestCase;
 
@@ -193,6 +194,14 @@
 
     public String getContextPath() {
       return "/test";
+    }
+
+    public Locale getPreferredLocale() {
+      return null;
+    }
+
+    public Locale[] getPreferredLocales() {
+      return null;
     }
     
   }



Mime
View raw message