I am using RESTEasy (implementation of JAX-RS).
I can’t find a way to set basic, preemptive, authentication to ClientRequest.
ClientRequest request = new ClientRequest("<url>");
// -- here I want to add basic-preemptive authentication --
ClientResponse response = request.get();
System.out.println(response.getEntity(String.class));
What the correct way to do it?
Is there any other way to do it?
Thank you.
If you look at the constructors in
ClientRequest, you will see that one of them takes a string and aClientExecutor.So you can do something like this: