|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.opencms.i18n.CmsAcceptLanguageHeaderParser
public class CmsAcceptLanguageHeaderParser
Parses the HTTP Accept-Language header as per section 14.4 of RFC 2068
(HTTP 1.1 header field definitions) and creates a sorted list of Locales from it.
| Field Summary | |
|---|---|
static String |
ACCEPT_LANGUAGE
A constant for the HTTP Accept-Language header. |
protected static Float |
DEFAULT_QUALITY
The default m_quality value for an AcceptLanguage object. |
| Constructor Summary | |
|---|---|
CmsAcceptLanguageHeaderParser(HttpServletRequest req,
Locale defaultLocale)
Parses the Accept-Language header from the provided request. |
|
CmsAcceptLanguageHeaderParser(String header,
Locale defaultLocale)
Parses the Accept-Language header. |
|
| Method Summary | |
|---|---|
static String |
createLanguageHeader()
Creates a value string for the HTTP Accept-Language header based on the default localed. |
List |
getAcceptedLocales()
Returns the sorted list of accepted Locales. |
boolean |
hasNext()
|
Object |
next()
Creates a Locale from the next element of the Accept-Language header. |
void |
remove()
Not implemented. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ACCEPT_LANGUAGE
Accept-Language header.
protected static final Float DEFAULT_QUALITY
AcceptLanguage object.
| Constructor Detail |
|---|
public CmsAcceptLanguageHeaderParser(HttpServletRequest req,
Locale defaultLocale)
Accept-Language header from the provided request.
req - the request to parsedefaultLocale - the default locale to use
public CmsAcceptLanguageHeaderParser(String header,
Locale defaultLocale)
Accept-Language header.
header - the Accept-Language header (i.e. en, es;q=0.8, zh-TW;q=0.1)defaultLocale - the default locale to use| Method Detail |
|---|
public static String createLanguageHeader()
public List getAcceptedLocales()
public boolean hasNext()
hasNext in interface Iteratorpublic Object next()
Locale from the next element of the Accept-Language header.
next in interface IteratorLocale.
public final void remove()
throws CmsIllegalArgumentException
remove in interface IteratorCmsIllegalArgumentException - always to signal that remove is not implemented
(interface contract defines UnsupportedOperationException)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||