Solved

Pass Header basic Auth using Jersey Client

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

919 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

13 Experts available now in Live!

Get 1:1 Help Now