I am trying to use the following code to make a client request in my server and it fails with an IllegalArgumentException, Host name may not be null.
WebTarget target = client.target("
https://{host}/{version}/tokens/proxy");
target.resolveTemplate("host", "public.example.com").resolveTemplate("version", "v2");
response = target.request(MediaType.APPLICATION_JSON)
.accept(MediaType.APPLICATION_JSON)
.header(HttpHeaders.AUTHORIZATION, accessToken)
.get(AdminTokenResponse.class);
If I use UriBuilder to build the Uri and then create a WebTarget from that: WebTarget target = client.target(uri), that works correctly.
I am using Jersey 2.2. Any suggestions?
--
Todd Donahue