Solved

Apache HttpCLient ->  Getting the server message based on status code

Posted on 2004-10-15
2
175 Views
Last Modified: 2011-09-20
here is how we get status.
        int status = client.executeMethod(method);

Now how to get the server message based on status using client object??

Regards
Sudhakar

0
Comment
Question by:sudhakar_koundinya
  • 2
2 Comments
 
LVL 19

Accepted Solution

by:
ramazanyich earned 125 total points
ID: 12319867
if (statusCode != HttpStatus.SC_OK) {
        System.err.println("Method failed: " + method.getStatusLine());
      }

      // Read the response body.
      byte[] responseBody = method.getResponseBody();
0
 
LVL 19

Expert Comment

by:ramazanyich
ID: 12319882
Check tutorial for HttpClient for usage guidelines:
http://jakarta.apache.org/commons/httpclient/tutorial.html
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

685 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