My understanding is that user agent comes into play in 5 places along the lifecycle of a client and it's request. The first to stamp it on a request wins.
- JerseyClientConfiguration This is where we set the client user agent
- JerseyInvocation#header If set on the jersey client request
- ClientRuntime#addUserAgent If there is no user agent set, it's set user agent on jersey request to a formatting of the apache connector name
- DropwizardApacheConnector This is where we currently ignore the user agent header on the jersey request, and don't stamp it on the apache request.
- RequestUserAgent#process If there is no user agent set on the request, use the client configuration user agent
You're proposing we don't ignore the jersey user agent when building the apache request, but that won't work as outlined below.
User agent not set on client or request --> Handled by 3 //Accurate
User agent set on client and request --> Handled by 2 //Accurate
User agent set on client, not request --> Handled by 4 //This breaks, as we will stamp the value calculated in 3
User agent not set on client, set on request --> Handled by 2 //Accurate
Ideally, the way it would work is to use the user agent in this priority, where the first one available wins: request provided, client config provided, client default. Unfortunately, I don't see a way to make it work this way.