org.apache.turbine.services.localization
Class LocaleTokenizer
java.lang.Object
|
+--org.apache.turbine.services.localization.LocaleTokenizer
- All Implemented Interfaces:
- java.util.Iterator
- public class LocaleTokenizer
- extends java.lang.Object
- implements java.util.Iterator
Parses the HTTP Accept-Language
header as per section
14.4 of RFC 2068 (HTTP 1.1 header field definitions).
- Version:
- $Id: LocaleTokenizer.java,v 1.1 2001/10/13 23:15:24 dlr Exp $
- Author:
- Daniel Rall
Field Summary |
private static java.lang.Float |
DEFAULT_QUALITY
The default quality value for an AcceptLanguage
object. |
private static java.lang.String |
LOCALE_SEPARATOR
Separates elements of the Accept-Language HTTP
header. |
private java.util.ArrayList |
locales
The parsed locales. |
private static char |
QUALITY_SEPARATOR
Separates locale from quality within elements. |
Constructor Summary |
LocaleTokenizer(java.lang.String header)
Parses the Accept-Language header. |
Method Summary |
boolean |
hasNext()
|
java.lang.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, registerNatives, toString, wait, wait, wait |
LOCALE_SEPARATOR
private static final java.lang.String LOCALE_SEPARATOR
- Separates elements of the
Accept-Language
HTTP
header.
QUALITY_SEPARATOR
private static final char QUALITY_SEPARATOR
- Separates locale from quality within elements.
DEFAULT_QUALITY
private static final java.lang.Float DEFAULT_QUALITY
- The default quality value for an
AcceptLanguage
object.
locales
private java.util.ArrayList locales
- The parsed locales.
LocaleTokenizer
public LocaleTokenizer(java.lang.String header)
- Parses the
Accept-Language
header.
- Parameters:
header
- The Accept-Language
header
(i.e. en, es;q=0.8, zh-TW;q=0.1
).
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface java.util.Iterator
- Returns:
- Whether there are more locales.
next
public java.lang.Object next()
- Creates a
Locale
from the next element of the
Accept-Language
header.
- Specified by:
next
in interface java.util.Iterator
- Returns:
- The next highest-rated
Locale
. - Throws:
java.util.NoSuchElementException
- No more locales.
remove
public final void remove()
- Not implemented.
- Specified by:
remove
in interface java.util.Iterator
Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.