Package rife.tools

Enum Class Product

All Implemented Interfaces:
Serializable, Comparable<Product>, Constable

public enum Product extends Enum<Product>
Represents a product that identifies itself in HTTP User-Agent headers.

Each product defines the exact token used in the Product/Version portion and a canonical URL for the comment section, following RFC 9110 conventions.

Examples:

  • bld/2.3.1 (Java 21.0.1; Linux 6.5.0) (+https://rife2.com/bld)
  • RIFE2/1.9.1 (Java 26.0.1; Mac OS X 10.16) (+https://rife2.com)
Since:
1.9.4
  • Enum Constant Details

    • BLD

      public static final Product BLD
      The Bld build system.

      Uses lowercase bld as the product token in the User-Agent.

      See Also:
    • RIFE2

      public static final Product RIFE2
      The RIFE2 full-stack web framework.

      Uses uppercase RIFE2 as the product token in the User-Agent.

      See Also:
  • Method Details

    • values

      public static Product[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Product valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • token

      public String token()
      Returns the exact product token to use in the User-Agent header.

      This value preserves the intended casing and should be used directly in the Product/Version portion of the header.

      Returns:
      the product token, e.g. "bld" or "RIFE2"
    • url

      public String url()
      Returns the canonical project URL for this product.

      Intended for inclusion in the User-Agent comment section as (+url) so server operators can identify the client.

      Returns:
      the project URL, never null
    • toUserAgent

      public String toUserAgent(String version)
      Builds a complete User-Agent string for this product and the given version.

      The format follows RFC 9110: Product/Version (system-info) (+url)

      Parameters:
      version - the version of the product, non-null, e.g. "2.1.0"
      Returns:
      a formatted User-Agent string
      Throws:
      NullPointerException - if version is null