Class WarningHeaderValue
java.lang.Object
org.gcube.informationsystem.resourceregistry.http.headers.warning.WarningHeaderValue
Shared constants and utilities for
X-Warning header values.- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe warning agent string identifier.static final intThe JAX-RS standard warning code. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringencodeToken(String value) Percent-encodes a header token using UTF-8 bytes.static StringextractWarnText(String headerValue) Extracts<warn-text>from a formatted warning header value.static StringFormats warning text into the canonical header value:<warn-code> <warn-agent> "<warn-text>".
-
Field Details
-
WARN_AGENT
The warning agent string identifier.- See Also:
-
WARN_CODE
public static final int WARN_CODEThe JAX-RS standard warning code.- See Also:
-
-
Method Details
-
encodeToken
Percent-encodes a header token using UTF-8 bytes.Unreserved characters from RFC 3986 (
ALPHA / DIGIT / - . _ ~) are preserved as-is; all other bytes are encoded as%HH.- Parameters:
value- the raw string token to encode- Returns:
- the percent-encoded token string
-
format
Formats warning text into the canonical header value:<warn-code> <warn-agent> "<warn-text>".- Parameters:
warnText- the text of the warning- Returns:
- the formatted warning header value string
-
extractWarnText
Extracts<warn-text>from a formatted warning header value. Returns empty string when the input is malformed.- Parameters:
headerValue- the raw formatted warning header value- Returns:
- the extracted warning text string, or empty string if malformed
-