Solved

Pass Header basic Auth using Jersey Client

Posted on 2014-01-10
3
517 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need a Simple Email Client Plugin - Ajax / PHP / MySQL 3 214
Need help designing buttons for my website 6 194
Redirect domain based on region 4 129
website content maintenance 3 100
I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server. 1st - It creates a temp C…
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…
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…

808 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