Interface UserAgent


@Immutable public interface UserAgent
Constructs, validates, and formats a canonical User-Agent header. Because the http header spec (https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2) requires headers to be joined on commas, individual UserAgent.Agent header strings must never contain commas.
  • Method Details

    • nodeId

      @Lazy default Optional<@Safe String> nodeId()
      Identifies the node (e.g., IP address, container identifier, etc) on which this user agent was constructed.
    • primary

      UserAgent.Agent primary()
      The primary user agent, typically the name/version of the service initiating an RPC call.
    • informational

      List<UserAgent.Agent> informational()
      A list of additional libraries that participate (client-side) in the RPC call, for instance RPC libraries, API JARs, etc.
    • of

      static UserAgent of(UserAgent.Agent agent, @Safe @Safe String nodeId)
      Creates a new UserAgent with the given primary() agent and originating node id.
    • of

      static UserAgent of(UserAgent.Agent agent)
      Like of(Agent, String), but with an empty/unknown node id. Users should generally prefer the version with explicit node in order to facilitate server-side client trackingb
    • of

      static UserAgent of(UserAgent base, Iterable<UserAgent.Agent> additional)
      Returns a user agent with the given base agent combined with specified additional informational agents.
    • addAgent

      default UserAgent addAgent(UserAgent.Agent agent)
      Returns a new UserAgent instance whose informational() agents are this instance's agents plus the given agent.