Solved

Pass Header basic Auth using Jersey Client

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

Expert Comment

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

Accepted Solution

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

Author Closing Comment

by:NishantKashyap
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now