Pass Header basic Auth using Jersey Client

I am fairly new to Rest , I am stuck

I need to pass a header like :-
name ="Authorization"
value = "Basic xxxxxxxxxxxx"

My code is:
Client c = ClientBuilder.newBuilder().register(MultiPartFeature.class).build();
 Response info=<URL>).property("Authorization", "Basic xxxxxxxxxxxx").request().get();

The response I got is:-
InboundJaxrsResponse{ClientResponse{method=GET, uri=<my URL> status=401, reason=Unauthorized}}

what is the correct way to pass a header ?
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

NishantKashyapConnect With a Mentor Author Commented:
I updated my Jersey client to 2.X and the issue was resolved.
käµfm³d 👽Commented:
Did you base-64-encode the "xxxxxxxxxxxxxxx" part?
NishantKashyapAuthor Commented:
There was bug with the earlier jersey client which I was using , When I upgraded to 2.4 version , it worked fine.
All Courses

From novice to tech pro — start learning today.