Package org.forgerock.http.header
Class AcceptLanguageHeader
- java.lang.Object
-
- org.forgerock.http.protocol.Header
-
- org.forgerock.http.header.AcceptLanguageHeader
-
public final class AcceptLanguageHeader extends Header
A header class representing the Accept-Language HTTP header. String values will include quality attributes to communicate order of preference expressed in the list ofLocale
objects contained within.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description PreferredLocales
getLocales()
Returns thePreferredLocales
instance that represents this header.String
getName()
Returns the name of the header, as it would canonically appear within an HTTP message.List<String>
getValues()
Returns the header as a list of strings.static AcceptLanguageHeader
valueOf(String... languageTags)
Create a header from a list of preferredLocale
language tags.static AcceptLanguageHeader
valueOf(List<Locale> locales)
Create a header from a list of preferredLocale
instances.static AcceptLanguageHeader
valueOf(Set<String> headerValues)
Create a header from a list of header values.static AcceptLanguageHeader
valueOf(PreferredLocales locales)
Creates an accept language header representation for aPreferredLocales
instance.-
Methods inherited from class org.forgerock.http.protocol.Header
equals, getFirstValue, hashCode, toString
-
-
-
-
Field Detail
-
NAME
public static final String NAME
The name of the header.- See Also:
- Constant Field Values
-
-
Method Detail
-
valueOf
public static AcceptLanguageHeader valueOf(PreferredLocales locales)
Creates an accept language header representation for aPreferredLocales
instance.- Parameters:
locales
- The preferred locales.- Returns:
- The header.
-
valueOf
public static AcceptLanguageHeader valueOf(List<Locale> locales)
Create a header from a list of preferredLocale
instances.- Parameters:
locales
- The preferred locales.- Returns:
- The header.
-
valueOf
public static AcceptLanguageHeader valueOf(String... languageTags)
Create a header from a list of preferredLocale
language tags.- Parameters:
languageTags
- The preferred locale language tags.- Returns:
- The header.
-
valueOf
public static AcceptLanguageHeader valueOf(Set<String> headerValues)
Create a header from a list of header values.- Parameters:
headerValues
- The Accept-Language header values.- Returns:
- The header.
-
getLocales
public PreferredLocales getLocales()
Returns thePreferredLocales
instance that represents this header.- Returns:
- The instance.
-
getName
public String getName()
Description copied from class:Header
Returns the name of the header, as it would canonically appear within an HTTP message.
-
getValues
public List<String> getValues()
Description copied from class:Header
Returns the header as a list of strings. If the header has no values then it must return an empty list, never null. EachString
should represent the value component of the key-value pair that makes up the HTTP header - as such, for someHeader
implementations each String in thisList
may contain multiple token-separated values.The
List
returned from this method should not be expected to be mutable. However, some subclasses ofHeader
may choose to implement it as such.
-
-