Class UserAgents
java.lang.Object
com.palantir.conjure.java.api.config.service.UserAgents
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringTheagent nameidentifying the conjure-java library in aUserAgent. -
Method Summary
Modifier and TypeMethodDescriptionstatic @Safe StringReturns the canonical string format for the givenUserAgent.static UserAgentParses the given string into aUserAgentor throws anIllegalArgumentExceptionif no correctly formatted primary user agent can be found.static UserAgentLikeparse(String), but never fails and returns the primary agentunknown/0.0.0if no valid primary agent can be parsed.static StringtryParsePrimaryName(@Safe String userAgent) Parse and return only the `name` component of the primary user-agent string, or "unknown" if no valid primary agent name can be parsed.
-
Field Details
-
CONJURE_AGENT_NAME
Theagent nameidentifying the conjure-java library in aUserAgent.- See Also:
-
-
Method Details
-
format
-
parse
Parses the given string into aUserAgentor throws anIllegalArgumentExceptionif no correctly formatted primary user agent can be found. Incorrectly formatted informational agents are omitted.Valid user agent strings loosely follow RFC 7230 (https://tools.ietf.org/html/rfc7230#section-3.2.6).
-
tryParse
Likeparse(String), but never fails and returns the primary agentunknown/0.0.0if no valid primary agent can be parsed. -
tryParsePrimaryName
Parse and return only the `name` component of the primary user-agent string, or "unknown" if no valid primary agent name can be parsed. This is functionally similar to calling `tryParse(userAgent).primary().name()`, but optimized to not use regular expressions.
-