Package rife.tools
Enum Class Product
- All Implemented Interfaces:
Serializable,Comparable<Product>,Constable
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
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptiontoken()Returns the exact product token to use in the User-Agent header.toUserAgent(String version) Builds a complete User-Agent string for this product and the given version.url()Returns the canonical project URL for this product.static ProductReturns the enum constant of this class with the specified name.static Product[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BLD
The Bld build system.Uses lowercase
bldas the product token in the User-Agent.- See Also:
-
RIFE2
The RIFE2 full-stack web framework.Uses uppercase
RIFE2as the product token in the User-Agent.- See Also:
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
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/Versionportion of the header.- Returns:
- the product token, e.g.
"bld"or"RIFE2"
-
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
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- ifversionisnull
-