public class AcceptLanguageParser extends Object
Modifier and Type | Class and Description |
---|---|
static class |
AcceptLanguageParser.AcceptLanguage
Parsed language, country, locale and qvalue.
|
static class |
AcceptLanguageParser.AcceptLanguageComparator |
Modifier and Type | Field and Description |
---|---|
static AcceptLanguageParser.AcceptLanguageComparator |
acceptLanguageComparator
Reusable comparator used to sort languages by their qvalue.
|
static int |
S_COUNTRY
Country state.
|
static int |
S_COUNTRY_SPC
Country parsed state.
|
static int |
S_EQ
State equal.
|
static int |
S_LANG
Language state.
|
static int |
S_NAME
State name.
|
static int |
S_NAME_SPC
State parsed name.
|
static int |
S_SEMICOLON
Semicolon state.
|
static int |
S_START_SPC
Start state.
|
static int |
S_VALUE
State value.
|
Constructor and Description |
---|
AcceptLanguageParser() |
Modifier and Type | Method and Description |
---|---|
static List<AcceptLanguageParser.AcceptLanguage> |
parseHeader(javax.servlet.http.HttpServletRequest req)
Parses a HTTP accept-language header, if present, from the supplied HTTP request and returns a sorted list of valid languages.
|
static List<AcceptLanguageParser.AcceptLanguage> |
parseHeader(String acceptLanguageStr)
Parses a HTTP accept-language header string and returns a sorted list of valid languages.
|
public static final int S_START_SPC
public static final int S_LANG
public static final int S_COUNTRY
public static final int S_COUNTRY_SPC
public static final int S_SEMICOLON
public static final int S_NAME
public static final int S_NAME_SPC
public static final int S_EQ
public static final int S_VALUE
public static AcceptLanguageParser.AcceptLanguageComparator acceptLanguageComparator
public AcceptLanguageParser()
public static List<AcceptLanguageParser.AcceptLanguage> parseHeader(javax.servlet.http.HttpServletRequest req)
acceptLanguageStr
- accept language header string from a HTTP requestList
of valid languages sorted by their qvaluepublic static List<AcceptLanguageParser.AcceptLanguage> parseHeader(String acceptLanguageStr)
acceptLanguageStr
- accept language header string from a HTTP requestList
of valid languages sorted by their qvalueCopyright © 2005–2018 The Royal Danish Library, the National Library of France and the Austrian National Library.. All rights reserved.