org.clazzes.util.http
Class LocaleHelper

java.lang.Object
  extended by org.clazzes.util.http.LocaleHelper

public abstract class LocaleHelper
extends Object

This class provides static functionality for handling locales.


Constructor Summary
LocaleHelper()
           
 
Method Summary
static AcceptMatcher getLocaleMatcher()
           
static String selectLocale(String acceptLanguage, String[] supportedLocales)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocaleHelper

public LocaleHelper()
Method Detail

getLocaleMatcher

public static final AcceptMatcher getLocaleMatcher()
Returns:
A matcher for locales in an Accept-Language header.

selectLocale

public static String selectLocale(String acceptLanguage,
                                  String[] supportedLocales)
Parameters:
acceptLanguage - The content of an Accept-Language header (see section 14.3 of RFC2616).
supportedLocales - A list of supported encodings to choose from.
Returns:
The encoding selected to use for the given browser of null, if no matching encoding could be found.


Copyright © 2012. All Rights Reserved.