Solved

Pass Header basic Auth using Jersey Client

Posted on 2014-01-10
3
514 Views
Last Modified: 2014-01-29
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= c.target(<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 ?
0
Comment
Question by:NishantKashyap
  • 2
3 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39770888
Did you base-64-encode the "xxxxxxxxxxxxxxx" part?
0
 

Accepted Solution

by:
NishantKashyap earned 0 total points
ID: 39808027
I updated my Jersey client to 2.X and the issue was resolved.
0
 

Author Closing Comment

by:NishantKashyap
ID: 39817306
There was bug with the earlier jersey client which I was using , When I upgraded to 2.4 version , it worked fine.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
Before we dive into the marketing strategies involved with creating an effective homepage, it’s crucial that EE members know what a homepage is. In essence, a homepage is the introductory, or default page, of a website that typically highlights the …
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

774 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question