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 8647587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:06:25+00:00 2026-06-12T13:06:25+00:00

How can I access the data which is sent by POST method (Android) in

  • 0

How can I access the data which is sent by POST method (Android) in the jersey POST annotation?
Android Client:

public class TestClient extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_main);
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("myURL");

        try {

            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
            nameValuePairs.add(new BasicNameValuePair("user", "user1"));
            nameValuePairs.add(new BasicNameValuePair("password", "password1"));
            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

            httpclient.execute(httppost);

        } catch (ClientProtocolException e) {

        } catch (IOException e) {

        }

    }

}

The following is the code of the Server which is run on Localhost by Tomcat:

@Path("test")
public class Test {
     @GET
     @Produces(MediaType.TEXT_PLAIN)
        public String respondAsReady() {
            return "Running";
        }

     @POST
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
     @Produces(MediaType.TEXT_PLAIN or other?)

              //Here I'd like the program to post (with System.out.println) the data to the console which is uploaded by the client using the POST method.


        }
}
  • 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-06-12T13:06:27+00:00Added an answer on June 12, 2026 at 1:06 pm

    Regardless of whether the client is PHP, html, or android using httpclient the server side shouldn’t care. You should be able to use the @FormParam annotation to get the values. See the answer in the question I posted in the comments, or this example.

    You should be able to change your answer to something simpler like :

    @POST
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public void themethodname(@FormParam("user") String user, 
                              @FormParam("password") String password) {
        System.out.println("Username: "+user+", "+"Password: "+password);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can we use Business Objects which we made & data acess Layer of LINQ?
I'm trying to pull in data from a remote SQL Server. I can access
How can I use Enterprise Library to do a Data Access Layer in c#
Can anyone please help me to understand how should i access json data in
Each request in my web app can get one data access object instance (of
can anyone tell me how to select data by date in MS.ACCESS database using
Can anyone give me some idea about uploading data from excel to access database
I am sending a POST request to a web-service which returns data in XML
I'm trying to learn how to use CURL and Json to access data sent
I have a repository layer that is responsible for my data-access, which is called

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.