Interface CHParser

All Superinterfaces:
Serializable
All Known Implementing Classes:
ParseSecChUa, ParseSecChUaArch, ParseSecChUaBitness, ParseSecChUaFormFactor, ParseSecChUaFullVersion, ParseSecChUaFullVersionList, ParseSecChUaMobile, ParseSecChUaModel, ParseSecChUaPlatform, ParseSecChUaPlatformVersion, ParseSecChUaWoW64

public interface CHParser extends Serializable
  • Field Details

    • SF_STRING_PATTERN

      static final Pattern SF_STRING_PATTERN
  • Method Details

    • parse

      @Nonnull ClientHints parse(@Nonnull Map<String,String> clientHintsHeaders, @Nonnull ClientHints clientHints, @Nonnull String headerName)
      Parses the provided Client Hints request Headers and updates the provided ClientHints instance
      Parameters:
      clientHintsHeaders - The map of request headers that at least contains one of the supported fields
      clientHints - The instance that is to be updated
      headerName - The actual name of the header (must do case-insensitive compare!)
      Returns:
      The same instance as the provided clientHints parameter.
    • inputField

      @Nonnull String inputField()
      What Client Hint can this parser do something with?
      Returns:
      The nonnull header name this parser can handle.
    • parseBoolean

      default Boolean parseBoolean(String value)
      Determines if the provided value is a sf-boolean.
      Parameters:
      value - The value to be parsed
      Returns:
      True/False or null if this was NOT a boolean.
    • parseSfString

      default String parseSfString(String value)
      A sf-string is a String with '"' around it.
      Parameters:
      value - The value to be parsed
      Returns:
      The actual payload string (i.e. without the surrounding '"') or null if invalid
    • parseSfList

      default ArrayList<String> parseSfList(String value)
      A sf-list is a ',' separated list of sf-string.
      Parameters:
      value - The value to be parsed
      Returns:
      The list of actual payload strings (i.e. without the surrounding '"') or null if invalid
    • initializeCache

      default void initializeCache(@Nonnull AbstractUserAgentAnalyzer.ClientHintsCacheInstantiator<?> clientHintsCacheInstantiator, int cacheSize)
    • clearCache

      default void clearCache()