Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5850515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T13:09:04+00:00 2026-05-22T13:09:04+00:00

I have written REST web service in netbean IDE using jersey framework and java.

  • 0

I have written REST web service in netbean IDE using jersey framework and java. For every request user need to provide username and password , I know the authentication is not good.
Using curl command like :
curl -u username:password -X PUT http://localhsot:8080/user

Now I want to call REST web service from android class.What should I write? I am new to android. I have a android class which use DefaultHttpClient and CredentialUsernameAndPassword.
But when i run in eclipse, sometime I get runtime exception or sdk exception.

Do anyone give me sample code and suggestion?

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T13:09:05+00:00Added an answer on May 22, 2026 at 1:09 pm

    Do you use basic authentication? if so: use this.

    if (username != null && password != null) {
                client.getCredentialsProvider().setCredentials(
                        new AuthScope(null, -1),
                        new UsernamePasswordCredentials(username, password));
            }
    

    or you can add those in a header as setHeader(“Authentication”, “Basic “+Base64EncodedString(username,pass);

    What you are doing is using Proxy authentication. why?

    this article may also be helpful somehow:

    link

    also the -u stands for the ntlm authorization so maybe look into that too. there were some topics where it said it is not supported on android or something but i am sure if you need it you can make a workaround.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a REST web service with Jersey Server (that totally rocks !).
I have writing Java code Using Jersey library to call Rest APIs. For my
I need to profile a server-client Java application (based on Jersey/REST FYI). I have
We have created RESTful web services using Spring's REST support. We need to call
I have written a service that I would like expose both via rest and
I have a REST web-service interface that calls-down to a service layer which orchestrates
i have written a stand alone WCF REST service in 4.0 under Studio 2010
I have written a REST Service in WCF in which I have created a
I've written a simple REST service class, and I need to deploy and run
How would one create a REST web service to write a row into a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.