org.apache.fulcrum.localization
Class LocaleTokenizer

java.lang.Object
  extended by org.apache.fulcrum.localization.LocaleTokenizer
All Implemented Interfaces:
Iterator

public class LocaleTokenizer
extends Object
implements 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 670330 2008-06-22 09:37:21Z tv $
Author:
Daniel Rall

Nested Class Summary
protected static class LocaleTokenizer.AcceptLanguage
          Struct representing an element of the HTTP Accept-Language header.
 
Field Summary
protected static Float DEFAULT_QUALITY
          The default quality value for an AcceptLanguage object.
 
Constructor Summary
LocaleTokenizer(String header)
          Parses the Accept-Language header.
 
Method Summary
 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

DEFAULT_QUALITY

protected static final Float DEFAULT_QUALITY
The default quality value for an AcceptLanguage object.

Constructor Detail

LocaleTokenizer

public LocaleTokenizer(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).
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator
Returns:
Whether there are more locales.

next

public Object next()
Creates a Locale from the next element of the Accept-Language header.

Specified by:
next in interface Iterator
Returns:
The next highest-rated Locale.
Throws:
NoSuchElementException - No more locales.

remove

public final void remove()
Not implemented.

Specified by:
remove in interface Iterator


Copyright © 2005-2009 The Apache Software Foundation. All Rights Reserved.