Package wt.httpgw
Class LanguagePreference
java.lang.Object
wt.util.BaseLanguagePreference
wt.httpgw.LanguagePreference
public final class LanguagePreference
extends wt.util.BaseLanguagePreference
LanguagePreference contains methods used to parse HTTP Accept-Language strings and retrieve
the 'sub-parts' of the strings. These methods are for use when localizing a response to a
client HTTP request.
Supported API: true
Extendable: false
Supported API: true
Extendable: false
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.LanguagePreference(String language, double qvalue) Supported API: true -
Method Summary
Modifier and TypeMethodDescriptiongetAcceptLanguageLocales(String acceptLanguageString) Parses an HTTP Accept-Language header string and returns a list of Locale objects in order of decreasing preference,
Supported API: truestatic VectorgetAcceptLanguagePreferences(String acceptLanguageString) Deprecated.Returns the language string of the LanguagePreference object.static LocaleThis method takes a String of languages obtained from the request Accept-Language attribute and returns the most appropriate Windchill supported locale from the given set of languages.static LocalegetLocale(Collection<?> preferences) This method takes an ordered collection of languages obtained from the request Accept-Language attribute and returns the most appropriate Windchill supported locale from the given set of languages.static LocaleDeprecated.doubleReturns the qualtityValue of the LanguagePreference object.
-
Constructor Details
-
LanguagePreference
Deprecated.Supported API: true -
LanguagePreference
Supported API: true
-
-
Method Details
-
getQualityValue
public double getQualityValue()Returns the qualtityValue of the LanguagePreference object.
Supported API: true- Overrides:
getQualityValuein classwt.util.BaseLanguagePreference
-
getLanguage
Returns the language string of the LanguagePreference object.
Supported API: true- Overrides:
getLanguagein classwt.util.BaseLanguagePreference
-
getAcceptLanguagePreferences
@Deprecated public static Vector getAcceptLanguagePreferences(String acceptLanguageString) throws WTException Deprecated.Parses an HTTP Accept-Language string and returns a Vector of String representations of languages in order of decreasing preference.
Supported API: true- Parameters:
acceptLanguageString- Language preferences expressed in HTTP Accept-Language header value format- Returns:
- Vector of String representations of languages in order of descending preference
- Throws:
IEException- Never actually thrown; declared purely for backwards compilation compatibilityWTException- See Also:
-
getAcceptLanguageLocales
Parses an HTTP Accept-Language header string and returns a list of Locale objects in order of decreasing preference,
Supported API: true- Parameters:
acceptLanguageString- Language preferences expressed in HTTP Accept-Language header value format- Returns:
- List of Locale objects in order of decreasing preference
-
getLocale
Deprecated.This method takes a Vector of languages obtained from the request Accept-Language attribute and returns the most appropriate Windchill supported locale from the given set of languages.If no supported language if found in the Vector, the root locale is returned.
See: getLocale(String)
JSP Example:getLocale( getAcceptLanguagePreferences( request.getHeader("Accept-Language") ) );
Supported API: true- Parameters:
preferences- A Vector of languages from an HTTP request'sAccept-Languageheader as provided bygetAcceptLanguageLocales(java.lang.String)orgetAcceptLanguagePreferences(java.lang.String)- Returns:
- The Windchill locale.
- See Also:
-
getLocale
This method takes an ordered collection of languages obtained from the request Accept-Language attribute and returns the most appropriate Windchill supported locale from the given set of languages.If no supported language if found in the collection, the root locale is returned.
See: getLocale(String)
JSP Example:getLocale( getAcceptLanguageLocales( request.getHeader("Accept-Language") ) );
Supported API: true- Parameters:
preferences- An ordered collection of languages from an HTTP request'sAccept-Languageheader as provided bygetAcceptLanguageLocales(java.lang.String)orgetAcceptLanguagePreferences(java.lang.String)- Returns:
- The Windchill locale.
-
getLocale
This method takes a String of languages obtained from the request Accept-Language attribute and returns the most appropriate Windchill supported locale from the given set of languages.If no supported language if found in the String, the root locale is returned.
JSP Example:getLocale( request.getHeader("Accept-Language") );
Supported API: true- Parameters:
acceptLanguageString- An HTTP request'sAccept-Languageheader value.- Returns:
- The Windchill locale.
-