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 of Locale objects contained within.
  • Field Details

  • Method Details

    • valueOf

      public static AcceptLanguageHeader valueOf(PreferredLocales locales)
      Creates an accept language header representation for a PreferredLocales instance.
      Parameters:
      locales - The preferred locales.
      Returns:
      The header.
    • valueOf

      public static AcceptLanguageHeader valueOf(List<Locale> locales)
      Create a header from a list of preferred Locale instances.
      Parameters:
      locales - The preferred locales.
      Returns:
      The header.
    • valueOf

      public static AcceptLanguageHeader valueOf(String... languageTags)
      Create a header from a list of preferred Locale 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 the PreferredLocales 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.
      Specified by:
      getName in 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. Each String should represent the value component of the key-value pair that makes up the HTTP header - as such, for some Header implementations each String in this List may contain multiple token-separated values.

      The List returned from this method should not be expected to be mutable. However, some subclasses of Header may choose to implement it as such.

      Specified by:
      getValues in class Header
      Returns:
      The header as a non-null list of string values. Can be an empty list.