Class DeviceInfoResolver
User-Agent header into a coarse "os / browser"
description such as "Windows / Chrome 129", for
@Logged(includeDevice = true).
The raw header is never returned. Every result is assembled only from a fixed set of names and at most 4 digits of a major version, so nothing the client controls (including CR/LF or fake log text) can ever reach a log line. Only major versions are kept: IP address plus browser plus full version comes close to a device fingerprint, which is personal data under GDPR / KVKK.
Detection order matters: Edge and Opera user agents also contain
Chrome/, and Chrome's also contains Safari/, so the more
specific tokens are checked first. Known limitation: iPadOS in desktop
mode reports itself as macOS and is reported as such; no attempt is made
to guess otherwise.
This class never throws: it only uses contains/indexOf
lookups and bounds-checked substrings, so there is no failure path to
guard. Any input it cannot make sense of resolves to "unknown".
-
Field Summary
Fields -
Method Summary
-
Field Details
-
UNKNOWN
Placeholder for a missing, blank or unrecognized user agent.- See Also:
-
-
Method Details
-
resolve
Resolves a coarse device description from aUser-Agentheader.- Parameters:
userAgent- the raw header value, may benull- Returns:
- a value such as
"iOS 17 / Safari","curl","Bot", or "unknown"; nevernull
-